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

using loops for text boxes

P: 1
I have made 9 boxes and I want to check each one, the boxes are named txtBoxA1, txtBoxA2 and so on to A9. I want to

for i = 1 to 5
if txtboxAi = 1
then msgBox "all numbers are the same"
end if
next

My system is more complicated than this but this is the main problem I face.
Mar 24 '16 #1

✓ answered by Luk3r

Something like this should work:
Expand|Select|Wrap|Line Numbers
  1. Dim txtBoxMatches() As Control
  2. For i As Integer = 1 To 5
  3.   txtBoxMatches = Me.Controls.Find("txtBoxA" & i, True)
  4.   If txtBoxMatches.Text = 1
  5.     MsgBox("All Number Are The Same")
  6.   End If
  7. Next

Share this Question
Share on Google+
1 Reply


100+
P: 299
Something like this should work:
Expand|Select|Wrap|Line Numbers
  1. Dim txtBoxMatches() As Control
  2. For i As Integer = 1 To 5
  3.   txtBoxMatches = Me.Controls.Find("txtBoxA" & i, True)
  4.   If txtBoxMatches.Text = 1
  5.     MsgBox("All Number Are The Same")
  6.   End If
  7. Next
Mar 28 '16 #2

Post your reply

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