I'm building a VB application that accepts numbers in the beginning. I want to be able to exit if the user presses the cancel button in any of the input boxes. The code is :
Private Sub Command1_Click()
Dim a, b, c, d As Integer
Dim response As Integer
Dim a1, b1, c1, d1 As String
a = InputBox("Enter Numerator 1")
b = InputBox("Enter Denominator 1")
c = InputBox("Enter Numerator 2")
d = InputBox("Enter Denominator 2")
a1 = Str(a)
b1 = Str(b)
c1 = Str(c)
d1 = Str(d)
If a1 <> "" And b1 <> "" And c1 <> "" And d1 <> "" Then
'All Actions
...
Else
response = MsgBox("Are you sure you want to quit?", vbYesNo + vbQuestion, AdditionV1.0")
If response = vbYes Then
End
Else
Addition.Show
End If
I've tried using StrPtr and it stil doesnt work. What happens is even if I press Cancel, it still displays the error message.
Help will really be appreciated.