Re: [2008] perform action if value = 15 and descending
Hey,
How are you wanting to go about doing this detection?
Is it based on the user clicking a button? Or is it when the user enters something into the textbox and then leaves the textbox?
Can you provide some more information?
If for instance you wanted to do it on the click event of a button, you could use:
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text <> String.Empty AndAlso CInt(TextBox1.Text) <= 15 Then
MessageBox.Show("Entry is less than or equal to 15")
End If
End Sub
If however, you wanted to do it when the user left the textbox, you could do the same as the above, but you might want to use the Leave Event, or the TextChanged Event.
Gary
Re: [2008] perform action if value = 15 and descending
As gep said, depending on where you want to use the code will determine in which event handler you will place the code, but your code would look something like this:
Code:
Dim result As Integer
If Integer.TryParse(TextBox1.Text, result) AndAlso result <= 15 Then
' Do Some action
End If