I am trying to learn VB.NET and one of the tests I have been set is to write an application that will read the output of a textbox, check what it is, if it is between 10 and 20 then say thanks, if not then say wrong, then clear the textbox. Sounds simple, I know, but I can't for the life of me work out what I've done wrong:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim number As Integer
TextBox1.Text = number
If number > 10 And number < 20 Then
MsgBox("Thanks!")
Else
MsgBox("Wrong")
End If
Textbox1.Clear()
End Sub
End Class
Whenever I use that, it outputs Wrong every time :( Help please!
Thanks in advance,
Tom


Sign In
Create Account

Back to top









