Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

multiple lines in a text box

multiple lines in a text box

multiple lines in a text box

I've seen what I want in other programs but I'm not sure what it is. It appears to be a textbox with multiple rows and columns. I want to display 2 columns of numbers with as many rows as I need to dislay. A scollbar on the side allows the user to scroll to the position they want and change any data they need to modify. If each cell has a border it would be easier to see the divisions. Any idea what i need?

RE: multiple lines in a text box


What program and version?

Are you trying to add this control to a form, or are you trying to add this to a spreadsheet or other type of environment?

If you are working in a customized form then you might embed an excel spreadsheet into the form.  You do this by right-clicking on the toolbox of form controls, select Additional Controls, then scroll down until you find Microsoft Office Spreadsheet ##.#.  A new icon will appear in your toolbox pallete.  It may also be the Microsoft Flexgrid Control.  The flexgrid is usually bound to a database, but I think there is a way to use it without binding.  My license does not allow use of the flex grid control, so I can't help you beyond that statement.  The danger of adding new fancy controls to your toolbox is that not everyone else has the right DLL or OCX files, or you might run into licensing restrictions.  If everyone using your control is on the same version and same license then you should be okay.

The third option is to build your own grid of textboxes.  The object you are talking about may be a user-defined active X control.  VBA does not allow use of user-defined active X controls.  You can get around this by creating your own grid of text boxes and writing code to edit the form and the VBA module itself.  This requires the user to grant trusted access to the VBA module in the macro security settings.  If you don't want to get into macros that edit VBA code then you could just hide text boxes until the user needs to see them.

Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]

RE: multiple lines in a text box

I'm in Autocad 2010 which has Microsoft Visual Basic 6.5. I'm trying to add this to a form and I'd like to be able to add text boxes as required. I'm attaching a picture of the form I've seen that has what I want. I realize that VBA doesn't have all the capabilities that VB does. I will probably end up using a spreadsheet on the form but I'd like to have it look more like the attached picture.

I looked up the Flexgrid Control that yopu mentioned and it would be great, but I don't think it's availalbe in VBA.

I already have a grid (2 width by 20 high) of text boxes that is doing about what I want, but the user would like to be able to scroll. By the way, you gave a very good detailed reply to my question that really helped a lot. Thanks!

RE: multiple lines in a text box

You might try a ListView control.  I think that should be available in VBA.   

-handleman, CSWP (The new, easy test)

RE: multiple lines in a text box

The ListView control is new to me. I looked it up and it looks like what I want to use. Unfortunately, the application (AutoCAD) crashes when I try to place one on the form and gives me an error message..
"FATAL ERROR:Unhandled Access Violation Reading 0x00a4 Exception at 3706f3dh."
 I also tried in Excel and got a "Class Not Registered" error message. I guess I either don't have the dll on my computer or I need to do the regsvr32 command at the START button. Any ideas?

RE: multiple lines in a text box


You might try a ListView control.  I think that should be available in VBA.

I thought about that too, but I didn't think a list view would let you type data into the cells.  Have you been able to do this yourself?  I only have limited experience with them.  


I'm guessing that an embeded excel sheet is going to be the most practical option.  You might try taking your question over to www.tek-tips.com/  A lot of guys over there will have more experience with highly customized forms.

Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close