|
-
Nov 30th, 1999, 04:41 AM
#1
Thread Starter
Member
I have written the following code and it is giving a compile error" For without Next"
For ncontrolno = 0 To Employer.Controls.Count - 1
If TypeOf Employer.Controls(ncontrolno) Is TextBox Then
If Employer.Controls(ncontrolno(Index)) = 0 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Company Name"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 1 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Vocation"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 2 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Name"
Exit Sub
End If
Else
If Employer.Controls(ncontrolno(Index)) = 3 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a Address"
End If
Else
If Employer.Controls(ncontrolno(Index)) = 4 Then
If keyascii >= Asc("0") And keyascii <= Asc("9") Then
keyascii = 0
MsgBox "You must enter a City"
End If
Exit Sub
End If
End If
Next
Please help me!!
-
Nov 30th, 1999, 04:48 AM
#2
Member
nedeed for [cycle] and the finish of the cycle [next ncontrolno] and count the if and verify if with your [end if] repectly
ok
------------------
capv
-
Nov 30th, 1999, 04:52 AM
#3
Junior Member
what exactly are you trying to do ? seems like you want the user to enter between 0-9. right. check for the keyascii once and then display the message accordingly.
-
Nov 30th, 1999, 05:07 AM
#4
Thread Starter
Member
If you have a control array and want to check the index value of that control in a for next loop how do you do that????
-
Nov 30th, 1999, 05:30 AM
#5
Junior Member
i am assuming that your textboxes are in a control array. when the keypress event is trigerred, you will also get the index of the control for which the keypress was generated automatically. you don't have to do a for..next loop.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|