Vb6.0 如果要求文本框内的必须是6个数字 怎样写代码

2025-04-13 07:47:44
推荐回答(1个)
回答1:

Private Sub Form_Load()
Text1.MaxLength = 6
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then KeyAscii = 0
End Sub