Only allow numeric values in the textbox

前端 未结 12 930
南笙
南笙 2021-01-12 03:53

I want to make a TextBox control that only accepts numerical values.

How can I do this in VB6?

12条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-12 04:03

    If Len(Text2.Text) > 0 Then
        If IsNumeric(Text2.Text) = False Then
            Text2.SetFocus
            CreateObject("WScript.Shell").SendKeys "{BACKSPACE}"
        End If
    End If
    

提交回复
热议问题