Showing posts with label How to make textbox accept only numbers using C#. Show all posts
Showing posts with label How to make textbox accept only numbers using C#. Show all posts

Wednesday, September 11, 2013

How to make textbox accept only numbers?

  try
            {
               float number;
               number = float.Parse(textBox1.Text.ToString());
             }

            catch (Exception h)
            {
                MessageBox.Show("Please provide number only");
                textBox1.Text = "";
                textBox1.Focus();
            }