• Share

Here is a code segment help to achieve this task. This is helpful,when we developing a accounting software or buisiness softwares.
This code only works for VB 6.0 and not works for ‘pasting’ event.

Follow the instruction:

  • Place the following code in the module part of your project.
  • Call this function in the ‘Keypress’ event of

textbox.

Public Function SetNumericTextBox(Textbox As Textbox, KeyAscii)
If KeyAscii = vbKeyMenu Then
KeyAscii = 0
End If

If KeyAscii 8 Then
If KeyAscii = Asc(“.”) Then
If InStr(1, Textbox.Text, “.”) >= 1 Then
KeyAscii = 0
End If
End If
If InStr(1, “0123456789.”, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If

End Function

Thanking You
Shahul Hameed
e-mail:sinuxcreation@gmail.com

Author:

shahul hameed has written 2 awesome articles for us.

One Response to “Able to change textbox into a numerical(decimal) textbox in VB 6.0?”

  1. hola..!

Trackbacks/Pingbacks

  1. Tweets that mention Able to change textbox into a numerical(decimal) textbox in VB 6.0? | CeTly L!ve - College of Engineering Thalassery Live -- Topsy.com - [...] This post was mentioned on Twitter by CeTly L!ve. CeTly L!ve said: Able to change textbox into a numerical(decimal) ...

Leave a Reply

*