- Jun 14, 2003
- 10,442
- 0
- 0
hey, need a little help with input boxes
my lecturer said to us that if we make a input box pop up and ask for a number, the first thing he will do is put in a letter or nothing at all and press ok to see if we have coded in error checking or whatever
what he hasnt done, despite telling us what hes gonna do many times, is told us how you do this.
this is my code
Dim intCount As Integer
Dim strCharacter As String
Dim intValue As Integer
Dim intAttempt As Integer
intCount = 0
intAttempt = InputBox("how many attemtps does one wish to have?", "input attempts")
If intAttempt < 0 Then
MsgBox ("wrong")
Exit Sub
ElseIf intAttempt = 0 Then
MsgBox ("wrong")
Exit Sub
ElseIf intAttempt = "" Then
MsgBox ("wrong")
Exit Sub
End If
now, <0 and = 0 work just fine.
but what do i put in to check for nothing at all, or to check if there is a letter in there rather than a number?
my lecturer said to us that if we make a input box pop up and ask for a number, the first thing he will do is put in a letter or nothing at all and press ok to see if we have coded in error checking or whatever
what he hasnt done, despite telling us what hes gonna do many times, is told us how you do this.
this is my code
Dim intCount As Integer
Dim strCharacter As String
Dim intValue As Integer
Dim intAttempt As Integer
intCount = 0
intAttempt = InputBox("how many attemtps does one wish to have?", "input attempts")
If intAttempt < 0 Then
MsgBox ("wrong")
Exit Sub
ElseIf intAttempt = 0 Then
MsgBox ("wrong")
Exit Sub
ElseIf intAttempt = "" Then
MsgBox ("wrong")
Exit Sub
End If
now, <0 and = 0 work just fine.
but what do i put in to check for nothing at all, or to check if there is a letter in there rather than a number?
