Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please Help!

I just want my textbox to accept Numbers only and ONE Decimal point only.. of course Backspace and Delete button should working too.

here is my code


VB
Private Sub txtCost_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCost.KeyPress
      If e.KeyChar <> ControlChars.Back Then
          e.Handled = Not (Char.IsDigit(e.KeyChar) Or e.KeyChar = ".")
      End If
  End Sub



Please Help me.. thanks!
Posted
Updated 3-Apr-15 8:56am
v2

 
Share this answer
 
Comments
Member 9529406 4-Apr-15 3:42am    
thats already my code sir..
[no name] 4-Apr-15 5:24am    
check my ref..
Member 9529406 4-Apr-15 9:01am    
Thanks but I can't see the answer there
Member 9529406 4-Apr-15 12:49pm    
I posted the solution.. Thank you!
Member 9529406 4-Apr-15 12:50pm    
By the way if you can see my codes on my question. That's already my code... Thanks anyway.
got the answer from this!



https://www.youtube.com/watch?v=Zr_p9GTVRfw[^]



Thank you everyone!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900