Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15583

Looking inside a textbox if nothing

$
0
0
Hello everybody, I have a program that check for different "code" inside a textbox, if the user enter a know code, well a checkbox on the form become true. Also, if the user make a error and enter a
incorrect code, there a message box that tell him that a invalid code. The problem I have is if the user enter nothing, the program thing I have make a error, but the thing I want is I want to go out of the loop,

Here is my code , its a proprietary software from where I work , but it is based on .Net with some difference, where you see a Q before the variable, it is "query", it just query the value.

Code:


Dim LocksOptions() As String = {"KA","KT","KP","K1","KF","KC"}

For m As Integer = 0 To LocksOptions.length -1 
        If Q("TXB_CODE_ING").Contains(LocksOptions(m)) And LocksOptions(m) = "KA"  Then 
                Q("chkBoxKA")  = True 
                Exit For 
        Else If Q("TXB_CODE_ING").Contains(LocksOptions(m)) And LocksOptions(m) = "KT"  Then 
                Q("chkBoxKT")  = True
                Exit For
        Else If Q("TXB_CODE_ING").Contains(LocksOptions(m)) And LocksOptions(m) = "KP"  Then
                Q("chkBoxKP")  = True 
                Exit For 
        Else If Q("TXB_CODE_ING").Contains(LocksOptions(m)) And LocksOptions(m) = "K1"  Then 
                Q("chkBoxK1")  = True 
                Exit For 
        Else If Q("TXB_CODE_ING").Contains(LocksOptions(m)) And LocksOptions(m) = "KF"  Then
                Q("chkBoxKF")  = True 
                Exit For
        Else If Q("TXB_CODE_ING").Contains(LocksOptions(m)) And LocksOptions(m) = "KC"  Then
                Q("chkBoxKC")  = True 
                Exit For 
        Else If  Not  Q("TXB_CODE_ING").Contains(LocksOptions(m))  And m = LocksOptions.length-1  Then 
                msgbox("Invalid Locks Ing Code")
                Exit For 
        End If
Next

So what can I do so if the code see its empty, it go out of the loop? I have try to put a else at the end but if I do that it don't find any error after that.

Thank you

Viewing all articles
Browse latest Browse all 15583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>