我建了一个text1和一个comboBox
当combo1没被勾上.
text1里只能输入字母和数字.
当combo1被勾上后.就什么都可以输入.上面我已经写好了.
请问怎么让
combo被勾上后,如果已经输入了非字母和数字的字符.在combo去掉勾的时候.让text1=1111
当combo1没被勾上.
text1里只能输入字母和数字.
当combo1被勾上后.就什么都可以输入.上面我已经写好了.
请问怎么让
combo被勾上后,如果已经输入了非字母和数字的字符.在combo去掉勾的时候.让text1=1111
解决方案 »
- Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
- vb关闭程序问题!!!!!
- 请教一个关于波形显示的问题
- 在Setup Factory制作安装文件时,提示msxml2.dll不能activex自注册?为什么??
- 如何将JPG格式图片设置为桌面背景?
- 如何把word文档在vb中用控件打开
- 如何只允许操作本应用程序窗口,不允许执行其它任何程序,并且不允许关闭本应用程序窗口
- ?怎样自定义鼠标! 用mousepoint=99?
- 如何在代码中实现打开数据库服务器?
- command的结果给datagrid为何出错?
- 如何遍历系统盘 查找指定文件,然后再删除它?
- VB DoEvents函数有何弊端?有没有替代它的API函数?
怎么勾?
哈哈.
我也笑死了.
是checkBox
If Check1.Value = 0 Then Text1.Text = "1111"
End Sub
If Check1.Value = 0 Then
If Not IsNumeric(Text1.Text) Then Text1.Text = "1111"
End If
End Sub
这个我知道啊.
还要同时在text1里有其它字符才
text1=1111这样要怎么写呀.
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
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
只要 check1.value=0 并且text1里有 不是数字或字母的东西.
text1=1111
请问这样要怎么写呀.
上面的都是不管有没有其它字符,都会让text1=1111
谢谢!