大家帮忙看看程序那里出错了
vb.net吧
全部回复
仅看楼主
level 1
cdream 楼主
Public Class Form1
Private Sub Form1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click
Dim x, y As single
x = Val(InputBox("输入x的值", "对话框", 300))
If IsNumeric(x) = True Then
If x < 0 Then
MsgBox("请输入正数", MsgBoxStyle.Exclamation, "警告")
ElseIf x < 1000 Then
y = x
ElseIf x < 2000 Then
y = 0.9 * x
ElseIf x < 3000 Then
y = 0.8 * x
Else
y = 0.7 * x
End If
MsgBox(y)
Else
MsgBox("请输入数字", MsgBoxStyle.Exclamation, "警告")
End If
End Sub
End Class
最后这个else里面的msgbox无法显示
2014年10月17日 15点10分 1
level 2
调用函数里用到e可能是它的问题吧,不学久了可能我说的不对
2014年10月19日 04点10分 2
level 8
因为VAL一定能返回数字,首字符不为数字时返回0
2014年10月19日 16点10分 3
1