Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

how to create 2 dimension object array 1

Status
Not open for further replies.

shalet

Programmer
Nov 22, 2003
6
0
0
GB
I need an array of 4 x 6 text boxes, e.g. txtMytext(2,4).
How do I create them?
 
Not sure if you can do exactly what you want. How about having a row called text1(1) and so on and then text2(2).
Dont know if this is any help
Or you could do some cacluation, if you had an array like below

1 2 3
4 5 6
7 8 9

Then you could work out 7 is row 3 col 1

Hpe this helps

JP
 
Place 1 text box on a form.

Now in your code at run time you can make an array of this control using: load txtMyText(txtMyText.count)

Iterate through your array, using for and next loop, and each time you have a variable, add a textbox and place it in it.

Make sure when you create your instance of the textbox, you specify a position, so they don't all end up in the same place, and also ensure you inlclude a visible=true statement.

BB
 
In the Declaration section of the Form Module:

[tt]Dim txtMytext(3, 5) As TextBox[/tt]

to set up the array.

On the form create a regular array of 24 textboxes (txtDummy(0) to txtDummy(23)

At the end of the Form Load event assign the dummy array to your 2-dimensional array:
[tt]
For c = 0 To 3
For d = 0 To 5
Set txtMytext(c, d) = txtDummy(d + (6 * c))
Next d
Next c
[/tt]
and you're done!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
shalet
Please read faq222-2244 to see why you should keep posts on one subject in one thread. I suggest you reply in this thread and RedFlag the other thread for deletion.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top