Hi, I want to check if what a user enter on a textbox is present on a array. The code below do that, by the way, the Q("TXB_CODE_ING") mean it query the value of the textbox named "TXB_CODE_ING".It is
a way to query the value that come from a IDE from where I work.
So the code below will work if the user enter a option that exist in the allOptions array, but what I want to do is, if the user enter a option that do not exist, it exit the loop and display a error message.
So i have try this,just added a Not after the if
But that don't work, because the options that suppose to be ignored because they are valid are considered invalid and they will still be display.. hope its understandable.. :D
If anyone can help me with that!
Thank!
a way to query the value that come from a IDE from where I work.
So the code below will work if the user enter a option that exist in the allOptions array, but what I want to do is, if the user enter a option that do not exist, it exit the loop and display a error message.
Code:
Dim allOptions() As String = {"PP","AP","WP","TX","TZ","TY"}
Dim arrayVal() As String = Q("TXB_CODE_ING").split("-")
For i As Integer = 0 To arrayVal.length -1
For j As Integer = 0 To allOptions.length -1
If (allOptions(j).Contains( arrayVal(i))) Then
msgbox("we find it at position " &j)
Exit For
End If
Next
Next
Code:
Dim allOptions() As String = {"PP","AP","WP","TX","TZ","TY"}
Dim arrayVal() As String = Q("TXB_CODE_ING").split("-")
For i As Integer = 0 To arrayVal.length -1
For j As Integer = 0 To allOptions.length -1
If Not (allOptions(j).Contains( arrayVal(i))) Then
msgbox("Invalid Option " &i)
Exit For
End If
Next
Next
If anyone can help me with that!
Thank!