Hi go thr this

Sujit Patil replied to divya rocks at 12-May-08 03:07

Public Sub TextBox1_Validating(ByVal sender As Object, _
      ByVal e As System.ComponentModel.CancelEventArgs_
      Handles TextBox1.Validating

    try
    {
      int value=Int32.Parse(this.Text);
    }
    catch(Exception)
    {
      e.Cancel=true;
      MessageBox.Show("Please Enter Numeric Value");
    }

   OR Do like this;

int keyCode= Convert.ToInt16(e.KeyChar);

 if ((keyCode >= 97 && keyCode <= 122) || (keyCode == 8))

{

e.Handled = false;

}

else

{

e.Handled = true;

MessageBox.Show("Please Enter Numeric Value");

}


End Sub

Just go thr these links you will find it.

http://www.java2s.com/Code/VB/GUI/TextBoxValidatingEvent.htm

http://www.csharphelp.com/archives/archive64.html

http://www.csharphelp.com/archives/files/archive64/NumberBox.cs

Best Luck!!!!!!!!!!

Sujit.


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  textbox validation - divya rocks  12-May-08 02:46 2:46:51 AM
      here it is.. - santhosh kapa  12-May-08 02:52 2:52:31 AM
          spaces - divya rocks  12-May-08 03:06 3:06:08 AM
              Use keycode as 32 - Sujit Patil  12-May-08 03:10 3:10:06 AM
                  Use keycode as 32 - Sudha Konchada  14-May-08 02:15 2:15:33 AM
              add space ascii - santhosh kapa  12-May-08 03:10 3:10:12 AM
      Hi go thr this - Sujit Patil  12-May-08 03:07 3:07:37 AM
      textbox validation - Masked TextBox Concept - Rakesh Vikram  12-May-08 03:13 3:13:22 AM
      re: TextBox validation - Chirag Bhavsar  12-May-08 03:24 3:24:36 AM
      Check here... - Vasanthakumar D  12-May-08 03:16 3:16:02 AM
      Simple - Rave Rasaiyah  12-May-08 05:16 5:16:37 AM
      Costom control - Rave Rasaiyah  12-May-08 05:18 5:18:23 AM
      see this - Sanjay Verma  12-May-08 05:41 5:41:03 AM
      Textbox validation - Thiru Kumaran  12-May-08 01:45 1:45:19 PM
View Posts