Only allow numeric values in the textbox

前端 未结 12 1027
南笙
南笙 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:14

    Right click on control box > component > Control -> Microsoft Masked Edit Control 6.0.
    Or with normal textbox:

    Private Sub Text1_Validate(Cancel As Boolean)
     Cancel = Not IsNumeric(Text1.Text)
    
    End Sub
    

提交回复
热议问题