vb program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devonknows
    New Member
    • Nov 2006
    • 137

    #16
    Originally posted by nym11
    also one more question, how do i make it so if they put no value in the text box the program doesnt crash. i have it set so if they put a number above or below the array it gives a message box but if they do not put a number it crashes
    you need to check if the value of text1.text doesnt equal "", the code below shows how to check if its null and then check the values of text1.text, of course as always change to your own.

    Code:
    Private Sub Command1_Click()
    If Text1.Text <> "" Then
        If Text1.Text >= "1" And Text1.Text <= "10" Then
            MsgBox "Textbox has more than null value", vbInformation, "Info"
        Else
            MsgBox "Value has to be between or equal to 1 and 10.", vbInformation, "Info"
        End If
    Else
      MsgBox "You need to input a value", vbCritical, "Error"
    End If
    End Sub
    Hope this help,
    kind Regards
    Devon.

    Comment

    Working...