Validate a textbox

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2009
Posts: 11
Reputation: kimbula... is an unknown quantity at this point 
Solved Threads: 0
kimbula... kimbula... is offline Offline
Newbie Poster

Validate a textbox

 
0
  #1
Jul 12th, 2009
I want to validate a textbox so that only numeric values can be inserted in to it.
This validation should done while user enters the values.
For example.
Consider following keys had been pressed in a sequence

12345abcd678


only numeric values should appear in the textbox

so value which should be displayed in the textbox is
12345678

Any suggesions????? Please comment
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Re: Validate a textbox

 
1
  #2
Jul 12th, 2009
  1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
  2. If Asc(e.KeyChar) >= 48 And Asc(e.KeyChar) <= 57 Then
  3. e.Handled = False
  4. Else
  5. e.Handled = True
  6. End If
  7. End Sub
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Re: Validate a textbox

 
0
  #3
Jul 13th, 2009
hi kimbula, if u get answer to ur question, mark this thraed as solved,so dat it will be helpfull for others also
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 11
Reputation: kimbula... is an unknown quantity at this point 
Solved Threads: 0
kimbula... kimbula... is offline Offline
Newbie Poster

Re: Validate a textbox

 
0
  #4
Jul 14th, 2009
Sorry for my delayed actions.
Thank you very much. This is working
Awesome
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC