这是什么意思嘛?
你是想让ComboBox控件只允许输入数字吗?
讲详细点。

解决方案 »

  1.   

    在Keypress事件里过滤掉不要的字符不就可以了.
      

  2.   

    Private Sub Form_KeyPress(KeyAscii As Integer)
        If KeyAscii>=asc("1") And KeyAscii<=asc("0") Then
            '
        Else
            KeyAscii=0
        End If
    End Sub
      

  3.   

    错了。是:Private Sub ComboBox_KeyPress(KeyAscii As Integer)
        If KeyAscii>=asc("1") And KeyAscii<=asc("0") Then
            '
        Else
            KeyAscii=0
        End If
    End Sub
      

  4.   

    错了! 是:Private Sub ComboBox_KeyPress(KeyAscii As Integer)
        If chr(KeyAscii) like "#" and  KeyAscii<>8  Then
            KeyAscii=0
        End If
    End Sub
      

  5.   

    sorry!the right anser is:Private Sub ComboBox_KeyPress(KeyAscii As Integer)
        If not chr(KeyAscii) like "#" and  KeyAscii<>8  Then
            KeyAscii=0
        End If
    End Sub
      

  6.   

    错了。是:Private Sub ComboBox_KeyPress(KeyAscii As Integer)
        If KeyAscii>=asc("1") And KeyAscii<=asc("0") Or KeyAscii<>8 Then
            '
        Else
            KeyAscii=0
        End If
    End Sub
      

  7.   

    给你个自制函数,想让输入什么就定义什么
    Public Function ValiText(KeyIn As Integer, ValidateString As String, Editable As Boolean) As Integer
    Dim ValidateList As String
    Dim KeyOut As Integer
        If Editable = True Then
            ValidateList = UCase(ValidateString) & Chr(8)
        Else
            ValidateList = UCase(ValidateString)
        End If
        If InStr(1, ValidateList, UCase(Chr(KeyIn)), 1) > 0 Then
            KeyOut = KeyIn
        Else
            KeyOut = 0
            Beep
        End If
        
        ValiText = KeyOut
    End FunctionPrivate Sub ComboBox_KeyPress(KeyAscii As Integer)
        KeyAscii = ValiText(KeyAscii, "0123456789", True)
    End Sub