dim num1 as integer
dim num2 as single
dim num3 as single,num4 as single
num1=cint(text1.text)
num2=num*0.97
select case num2
case Is>200 
num3=num2-2
text2.text=cstr(num3)
case Is <200
num4=num2*0.99
text2.text=cstr(num4)

解决方案 »

  1.   

    这么简单为什么不自己写呢?
    if else都不会?
      

  2.   

    end select
    上面的num改为num1
      

  3.   

    嘻嘻!楼主是不是这个意思!
    One Example:
    1、非数字的检测,不允许输入
    2、第一个数字超出范围时的处理
    Dim num1 As Integer 'input number
    Dim num2 As Double
    Dim num3 As Double, num4 As Double 'output numberPrivate Sub Command1_Click()
        
        If Text1.Text = "" Then
            MsgBox "The Text is nothing!"
            Exit Sub
        End If
        On Error GoTo Error_Set
        num1 = CInt(Text1.Text)
        num2 = num1 * 0.97 '(CDbl(num1)) * 0.97 'Double
        Select Case num2
               Case Is > 200
                    num3 = num2 - 2
                    Text2.Text = CStr(num3)
               Case Is < 200
                    num4 = num2 * 0.99
                    Text2.Text = CStr(num4)
               Case Is = 200
                    num4 = num2
                    Text2.Text = CStr(num4)
        End Select
        Exit Sub
        
    Error_Set:
        MsgBox "Number OverFlow"
        Text1.Text = ""
        
    End SubPrivate Sub Form_Load()    Text1.Text = ""
        Text2.Text = ""End Sub'If Not Numerical,Not Input Text
    Private Sub Text1_KeyPress(KeyAscii As Integer)If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then
    Else: KeyAscii = 0End IfEnd Sub