| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1157 人关注过本帖
标题:请大侠帮忙看下“判断x,y在哪个象限”中的问题
只看楼主 加入收藏
wwljfth
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2017-4-10
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
请大侠帮忙看下“判断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
搜索更多相关主题的帖子: If Sub Text1 Text Then 
2019-12-12 22:44
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4938
专家分:30047
注 册:2008-10-15
收藏
得分:20 
看起来没啥大问题,
最后的提示错了,另外少了二组。

还有,X=0 或Y =0 时也要提示。这个在坐标轴上。

----------------
If IsNumeric(a) = False Or IsNumeric(b) = False Then 改为
If  IsNumeric(a)  and IsNumeric(b)  Then
IsNumeric(a) 如果为数值,那么返回 真
真 and 真 =真
真 and 假 =假
假 and 假 =假
有一个为假时,说明数据输入有误。

授人于鱼,不如授人于渔
早已停用QQ了
2019-12-13 18:17
快速回复:请大侠帮忙看下“判断x,y在哪个象限”中的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017093 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved