Private Sub 除_Click()
a = CInt(Text1.Text)
b = CInt(Text2.Text)
If b = 0 Then Text3.Text = "N" Text2.SetFocus Exit Sub
End If
result = a / b
Label2.Caption = "/"
Text3.Text = result
End Sub
为什么显示end if 没有块 if搞不懂
Private Sub 除_Click()
a = CInt(Text1.Text)'二个数
b = CInt(Text2.Text)
If b = 0 Then'除数为0 Text3.Text = "N"'要分成二行写,否则被认为一行IF,后面的 end if 就会报错。 Text2.SetFocus Exit Sub'退出过
End If
result = a / b'计算
Label2.Caption = "/"
Text3.Text = result
End Sub
a = CInt(Text1.Text)
b = CInt(Text2.Text)
If b = 0 Then
Text3.Text = "N" Text2.SetFocus Exit Sub
End If
result = a / b
Label2.Caption = "/"
Text3.Text = result
End Sub