先说谢谢了!
解决方案 »
- 文本框限制了只能输入数字,但小数点输入不了
- 为什么我在xp vb6.0下开发的软件,用setup factory7打包。在win98下不能安装
- 几个timer同步
- 我做了个ocx控件,我不知道把控件内面的vscrollbar初始化放在那儿?
- vb.net调用vb6编写的ocx函数出错
- 关于shell函数的问题
- 调用windows关机对话框的api函数是什么?
- 如何使用定义结构?如何对定义好的结构进行使用?请给一个完整的例子给我,谢谢!
- 推荐好书!
- 如何将在picture1图形控件上绘制的图形保存成磁盘文件
- vb的对象浏览器里看到的 类 成员 的疑问
- 如何快速遍历Treeview的一个节点的所有子节点?
Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
If DataGrid1.Col <> 2 Then Exit Sub '限制第3列的数据为(-,X,*)
If KeyAscii = 8 Then Exit Sub
If KeyAscii <> Asc("-") And KeyAscii <> Asc("X") And KeyAscii <> Asc("*") Then
KeyAscii = 0
End If
End Sub
If DataGrid1.Col <> 2 Then Exit Sub '限制第3列的数据为(-,X,*)
If KeyAscii = 8 Then Exit Sub
If Len(DataGrid1.Text) > 0 And DataGrid1.SelLength = 0 Then '限制只能输入一个字符
KeyAscii = 0
Exit Sub
End If
If KeyAscii <> Asc("-") And KeyAscii <> Asc("X") And KeyAscii <> Asc("*") Then
KeyAscii = 0
End If
End Sub
http://www.hosp.ncku.edu.tw/~cww/html/q00184.html