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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I create TextBox array ?

Status
Not open for further replies.
Dec 17, 2006
8
CA
Is it possible to create a text box array which allows to
have 100 text boxes on a form and then access them by their array index ?

I know I can enter them manually but I would prefer a simpler method.

Thanks

GubertDisentis

 
Do you want to create these 100 text boxes in an array in Design time or in Run time in VB 6.0?

Have fun.

---- Andy
 
Click on the text box.
Press CTRL-C
Press CTRL-V
Answer yes to the "Would you like to create a control array" question.
Press CTRL-V 98 more times.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
or...

Click on the text box.
Press CTRL-C
Press CTRL-V
Answer yes to the "Would you like to create a control array" question.
Press CTRL-V 9 more times.

Select all 10 text boxes
Press CTRL-C
Press CTRL-V 9 more times :)

Have fun.

---- Andy
 
or...

Click on the text box.
Press CTRL-C
Press CTRL-V
Answer yes to the "Would you like to create a control array" question.
Press CTRL-V 9 more times.

Select all 10 text boxes
Press CTRL-C
Press CTRL-V

Then Select all 20 text boxes
Press CTRL-C
Press CTRL-V 4 more times


or...;-)



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
There are many ways to 'skin the cat'
(Why would people want to skin the cat....? :) )

Have fun.

---- Andy
 
So you don't have to go to the doctor to get a catskin?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
All you really need to do is create a control array a design-time with one element, usually Index = 0. From there you can load additional elements at higher indexes, position them, then make each Visible. Read That Fine Manual, there's a wealth of information there. This is so basic it is probably covered in the intro "how to use VB" section.

I'm not sure if if those guys above are pulling your leg or clueless.

But 100 TextBoxes sounds a little nutty. Are you sure you don't really want a ListBox, a grid control, or the DataRepeater control instead?
 
Well, dilettante, read my very first post to this question and you'll see I did offer the run time solution. Since GubertDisentis wanted the Design solution, here it is. If that’s what he wanted, that’s what he got. I would guess he really needs 100 textboxes.

If he would want a ListBox, a grid control, or the DataRepeater, he would probably ask for it. Or at least asked: what would be the best way to do … (whatever he is after)

No, we are not “pulling your leg or clueless”, we just try to answer the question asked. That’s what this forum is all about.

Respectfully yours,


Have fun.

---- Andy
 
Well consider that he did ask for an alternative to manually creating 100 at design time. I don't see how copy/paste is particularly useful since you still have to position them all, and the entire process is still quite manual. So most of the answers given do not "just try to answer the question" but go right off into the weeds.

One suggestion I haven't seen yet is to use a script or separate program that edits the .FRM file itself, inserting the 100 entries where they'd belong. Another would be to create a custom IDE add-in that inserts the 100 controls into a Form.

But I still have doubts about the usefulness of 100 TextBox controls on one Form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top