我建了一个text1和一个comboBox
当combo1没被勾上.
text1里只能输入字母和数字.
当combo1被勾上后.就什么都可以输入.上面我已经写好了.
请问怎么让
combo被勾上后,如果已经输入了非字母和数字的字符.在combo去掉勾的时候.让text1=1111

解决方案 »

  1.   

    当combo1被勾上后???
    怎么勾?
      

  2.   

    说错了.
    哈哈.
    我也笑死了.
    是checkBox
      

  3.   

    Private Sub Check1_Click()
        If Check1.Value = 0 Then Text1.Text = "1111"
    End Sub
      

  4.   

    Private Sub Check1_Click()
        If Check1.Value = 0 Then
            If Not IsNumeric(Text1.Text) Then Text1.Text = "1111"
        End If
    End Sub
      

  5.   

    ls的.
    这个我知道啊.
    还要同时在text1里有其它字符才
    text1=1111这样要怎么写呀.
      

  6.   

    Private Sub Check1_Click()
        If Check1.Value = 0 Then
            If Len(Text1.Text) > 0 Then
                Text1.Text = "1111"
            End If
        End If
    End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
        If Check1.Value = 0 Then
            If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 8 Or KeyAscii = 9 Or KeyAscii = 10 Or KeyAscii = 13 Then
            Else
                KeyAscii = 0
                MsgBox "输入不合法."
            End If
        End If
    End Sub
      

  7.   


    Private Sub Check1_Click()
       If Not Check1.Value Then
          Dim i As Integer, istr As Byte
          For i = 1 To Len(Text1)
              istr = Asc(Mid(Text1, i, 1))
              If Not (istr >= 65 And istr <= 90 Or _
                 istr >= 97 And istr <= 122 Or _
                 istr >= 48 And istr <= 57) Then
                 Text1 = "11111"
                 Exit For
              End If
         Next
      End If
      
    End Sub
      

  8.   

    其它字符就是  不是数字和字母.
    只要 check1.value=0 并且text1里有 不是数字或字母的东西.
    text1=1111
    请问这样要怎么写呀.
    上面的都是不管有没有其它字符,都会让text1=1111
    谢谢!