By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

textbox array

P: n/a
Hi all,

I need to use hundreds of textboxes to display data. In VB 6.0, I can
assign the value by the loop with a textboxes array. How to do it in
VB.net?

Thanks a lot.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The textboxes ( like other controls ) are contained in Me.Controls.
For Each c as Control In Me.Controls

'Do your stuff here

Next

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"barbara" <ba**********@yahoo.com> wrote in message
news:69*************************@posting.google.co m...
Hi all,

I need to use hundreds of textboxes to display data. In VB 6.0, I can
assign the value by the loop with a textboxes array. How to do it in
VB.net?

Thanks a lot.

Nov 21 '05 #2

P: n/a
Hi,

I dont think having hundreds of textboxes is a good idea. Here is a
link on how to create a control array.

http://msdn.microsoft.com/library/de...et05132003.asp

Control array control
http://www.windowsforms.com/default....mID=16&mid=142

How to loop through controls on Form. Uses recursion to check for textboxes
on controls like panels.

CheckForTextBox(Me.Controls)

Private Sub CheckForTextBox(ByVal ctrls As Control.ControlCollection)

For Each ctrl As Control In ctrls

If TypeOf ctrl Is TextBox Then

DirectCast(ctrl,TextBox).Text="My New Value"

End If

CheckForTextBox(ctrl.Controls)

Next

End Sub
Ken
--------------------
"barbara" <ba**********@yahoo.com> wrote in message
news:69*************************@posting.google.co m...
Hi all,

I need to use hundreds of textboxes to display data. In VB 6.0, I can
assign the value by the loop with a textboxes array. How to do it in
VB.net?

Thanks a lot.
Nov 21 '05 #3

P: n/a

"barbara" <ba**********@yahoo.com> wrote

I need to use hundreds of textboxes to display data. In VB 6.0, I can
assign the value by the loop with a textboxes array. How to do it in
VB.net?

Can I suggest you re-think your design? Why do you need hundreds of
textboxes? The user can not possibly enter text in 100 different places
all at the same time.

Take note of the property grid in the IDE, it shows property names
and their values, where some of them are text values. When the values
need to be displayed, a lable or (in this case) a grid can be used. When
user input is needed, that is where a texbox is displayed and used....

FWIW, there is a Property grid control you can use, you simply need
to add it to your toolbox, it is not there by default. Read up on its use,
you may like it!

LFS
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.