Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21096

Numbers Only and - Only

$
0
0
Hi All

I am try to only type numbers in a textbox and stop letters from going into textbox which works fine, But I also want ------- to appear in textbox I looked up on the internet and should be vbKeySubtract so I added to one of the case lines but don't work just beeps

Can someone please help me out with this thanks

http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx

Private Sub Text1_KeyPress(KeyAscii As Integer)
'Accepts only numeric input

Select Case KeyAscii

Case vbKey0 To vbKey9

Case vbKeyBack, vbKeyClear, vbKeyDelete, vbKeySubtract

Case vbKeyLeft, vbKeyRight, vbKeyUp, vbKeyDown, vbKeyTab

Case Else

KeyAscii = 0

Beep

End Select

End Sub

Kind Regards

Steve

Viewing all articles
Browse latest Browse all 21096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>