请大侠帮忙看下“判断x,y在哪个象限”中的问题
Private Sub Command1_Click()Dim x As Integer, y As Integer, comma As Integer
Dim str As String, a As String, b As String
comma = InStr(Text1.Text, ",")
If comma = 0 Then comma = InStr(Text1.Text, ",")
If comma = 0 Then MsgBox "wrong input": Exit Sub
a = Left(Text1.Text, comma - 1)
b = Mid(Text1.Text, comma + 1)
If IsNumeric(a) = False Or IsNumeric(b) = False Then
MsgBox "must be vaild number!"
Exit Sub
Else
x = Val(a): y = Val(b)
End If
If (x > 0 And y > 0) Then
str = "(" & Text1.Text & ")" & "是在第一象限“"
ElseIf (x < 0 And y > 0) Then
str = "(" & Text1.Text & ")" & "是在第一象限“"
End If
End Sub