TEXT1+TEXT2+TEXT3=TEXT4的这种模式怎样实现在文本1+文本2+文本3的过程中他们的值自动在文本4里显示

解决方案 »

  1.   

    加一个command
    在command_click事件中写代码:
    TEXT4=TEXT1+TEXT2+TEXT3
      

  2.   

    Private Sub Command1_Click()
        If Trim(Text1) = "" Or Trim(Text2) = "" Or Trim(Text3) = "" Then
            Exit Sub
        ElseIf Not IsNumeric(Text1) And _
        Not IsNumeric(Text2) And Not IsNumeric(Text3) Then
            MsgBox "必需是数字"
            Exit Sub
        Else
            Text4 = Val(Text1) + Val(Text2) + Val(Text3)
        End If
    End Sub
      

  3.   

    Private Sub Text4_GotFocus()
     If Trim(Text1) = "" Or Trim(Text2) = "" Or Trim(Text3) = "" Then
            Exit Sub
        ElseIf Not IsNumeric(Text1) And _
        Not IsNumeric(Text2) And Not IsNumeric(Text3) Then
            MsgBox "必需是数字"
            Exit Sub
        Else
            Text4 = Val(Text1) + Val(Text2) + Val(Text3)
        End IfEnd Sub
      

  4.   

    Private Sub Text1_Change()
        If Not IsNumeric(Text1.Text) Then
            Text1.Text = ""
            Exit Sub
        End If
        AutoAdd
    End SubPrivate Sub Text2_Change()
    If Not IsNumeric(Text2.Text) Then
            Text2.Text = ""
            Exit Sub
        End If
        AutoAdd
    End SubPrivate Sub Text3_Change()
    If Not IsNumeric(Text3.Text) Then
            Text3.Text = ""
            Exit Sub
        End If
        AutoAdd
    End Sub
    Private Sub AutoAdd()
        Dim intNum1, intNum2, intNum3 As Integer
        
        intNum1 = CInt(IIf(IsNumeric(Text1.Text), Text1.Text, 0))
        intNum2 = CInt(IIf(IsNumeric(Text2.Text), Text2.Text, 0))
        intNum3 = CInt(IIf(IsNumeric(Text3.Text), Text3.Text, 0))
        Text4.Text = ""
        Text4.Text = intNum1 + intNum2 + intNum3
        
    End Sub
      

  5.   

    在Text_Change()事件中实现想要的运算啊。