943,702 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 1166
  • VB.NET RSS
Jul 12th, 2009
0

Validate a textbox

Expand Post »
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
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
kimbula... is offline Offline
14 posts
since Jun 2009
Jul 12th, 2009
1

Re: Validate a textbox

VB.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008
Jul 13th, 2009
0

Re: Validate a textbox

hi kimbula, if u get answer to ur question, mark this thraed as solved,so dat it will be helpfull for others also
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008
Jul 14th, 2009
0

Re: Validate a textbox

Sorry for my delayed actions.
Thank you very much. This is working
Awesome
Reputation Points: 9
Solved Threads: 0
Newbie Poster
kimbula... is offline Offline
14 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: update records+vb.net
Next Thread in VB.NET Forum Timeline: Promblem in Saving Data into Ms Access using VB.net . i am not able to save the data





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC