Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple lines in a text box

Status
Not open for further replies.

jrice174

Civil/Environmental
Nov 8, 2004
129
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?
 
Replies continue below

Recommended for you

jrice174

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.

-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
 
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!
 
 http://files.engineering.com/getfile.aspx?folder=42685215-b687-43f8-b856-7ca7d7e190fc&file=textarray.bmp
You might try a ListView control. I think that should be available in VBA.

-handleman, CSWP (The new, easy test)
 
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?
 
handleman
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.


jrice174,

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

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

Part and Inventory Search

Sponsor