Only allow numeric values in the textbox

前端 未结 12 934
南笙
南笙 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 03:57


    Just select the control and the keyPress method and the IDE create the next method for you. Then add the next code inside the method

    Private Sub txtControl_KeyPress(KeyAscii As Integer)
       KeyAscii = RealKeyascii(txtControl, KeyAscii, 256 ^ 8)
    End Sub
    

提交回复
热议问题