By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,097 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,097 IT Pros & Developers. It's quick & easy.

How to protect text box for writing of number and characters VB6

P: 16
How i can protext text box which i use for showing const of writing numbers and leters t.e char
Apr 3 '07 #1
Share this Question
Share on Google+
5 Replies


vijaydiwakar
100+
P: 579
How i can protext text box which i use for showing const of writing numbers and leters t.e char
Tress keyascii value and allow or disallow it
Apr 3 '07 #2

P: 16
Tress keyascii value and allow or disallow it
can you help me with the code? it txt3.text when i submit results
Apr 3 '07 #3

vijaydiwakar
100+
P: 579
can you help me with the code? it txt3.text when i submit results
this code may help u
Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_KeyPress(KeyAscii As Integer)
  2.     KeyAscii = validateonlunum(KeyAscii)
  3. End Sub
  4. Private Function validateonlunum(ByRef keyas As Integer)
  5. Dim Validstr$
  6. sValidstr = "0123456789"
  7.     If InStr(sValidstr, Chr(keyas)) = 0 Then validateonlunum = 0 Else validateonlunum = keyas
  8. End Function
  9.  
  10.  
Apr 3 '07 #4

P: 16
[quote=vijaydiwakar]this code may help u
[code]
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = validateonlunum(KeyAscii)
End Sub
When i write:

Private Function validateonlunum(ByRef keyas As Integer)
Dim Validstr$
sValidstr = "0123456789"
If InStr(sValidstr, Chr(keyas)) = 0 Then validateonlunum = 0 Else validateonlunum = keyas
End Function

Show me message: only comments may be appear after end sub end fuction.... well i can ask you for more help?
Apr 3 '07 #5

vijaydiwakar
100+
P: 579
see its a perfect sol try it
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Text1_KeyPress(KeyAscii As Integer)
  3.     KeyAscii = validateonlunum(KeyAscii)
  4. End Sub
  5. Private Function validateonlunum(ByRef keyas As Integer)
  6. Dim sValidstr$
  7. sValidstr = "0123456789"
  8.     If InStr(sValidstr, Chr(keyas)) = 0 Then validateonlunum = 0 Else validateonlunum = keyas
  9. End Function
  10.  
Apr 3 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.