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

how to make all textboxes allow only for numbers at once

$
0
0
I have a form with a huge number of textboxes, almost all of them are numeric

i usually use the following code to allow only for numbers in a textbox

Code:

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
End Sub

is it possible to apply this code for all of the textboxes at once so that i dont have to do it for each one of them.

Viewing all articles
Browse latest Browse all 21845

Trending Articles



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