How can i disable space in visual basic and how i can only put one hypen | Sololearn: Learn to code for FREE!

+1

How can i disable space in visual basic and how i can only put one hypen

I already have my codes but its not complete yet here it is If txtstudentnumber.text.contains("-") then If Char.IsDigit(e.KeyChar) or e.KeyChar = Chr (8) then e.Handled = True Else e.Handled = False End If End If

11/8/2018 11:15:00 AM

Ahmil Orijola

6 Answers

New Answer

0

I don't have a computer at home to check the code it could be like this. If Not Char. IsDigit(e. KeyChar) OrElse Not Char. Is Control(e. KeyChar) OrElse Not( e. KeyChar =chrW(8)) Then e. Handled = True End If

0

What are you trying to do?

0

im trying to make my textbox input only numbers and only 1 hypen

0

If Not Char. IsDigit(e. KeyChar) OrElse Not Char. Is Control(e. KeyChar) Then e. Handled = True End If This is to input only numbers in text box. Where you want to put your hifen?

0

numbers with only one hypen like for example a school id number 12-3271 like that

0