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

How to array textbox(i).text this means how to array all the text of the textboxes in

P: 1
I have many textbox in a form and I want to array the text of them, for example:
Expand|Select|Wrap|Line Numbers
  1. dim const max as integer=4
  2. dim c(1 to max) as string
  3. for i=1 to max
  4.    c(i)=textbox(i).text
  5. next i
Obviously this doesn't work.. Anyone knows how? please
May 2 '14 #1
Share this Question
Share on Google+
1 Reply


100+
P: 299
Well, your logic made sense... if only Visual Studio accepted that syntax :)

It's actually very easy, though. Give the below code a shot:
Expand|Select|Wrap|Line Numbers
  1. For Each txtBoxCtrl As TextBox In Controls.OfType(Of TextBox)()
  2.             MsgBox(txtBoxCtrl.Text)
  3.         Next
May 2 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.