Can Any One help with some simple Text Box VALIDATION Please Urgent

__avd commented: --reputation -2

Why is it so urgent?
Is your house on fire?
Don't post a message here in red. IT HAS THE SAME EFFECT AS SHOUTING!!!

Look in the code snippet section and you will certainly find what you where looking for. If not, come back here.

What do you want to validate? Stirng, int, double, bool?

if (textBox1.Text.Length < 10)
{
                MessageBox.Show("char input is less than 10");
}

You can test is in this way:
put on the from:
- textBox
- button
- label

Now create a method for a button_Click event and put use this code on it:

private void button1_Click(object sender, EventArgs e)
        {
            string sValue = textBox1.Text;
            int intValue = 0;
            decimal decValue = 0M;
            
            bool bValidating = int.TryParse(sValue, out intValue);
            if (!bValidating)
            {
                bValidating = decimal.TryParse(sValue, out decValue);
                if (!bValidating)
                    label1.Text = sValue + " is a string";
                else
                    label1.Text = sValue + " is a decimal";
            }
            else
                label1.Text = sValue + " is a integer";
        }

Hope it helps,
Mitja

Can i Use it with the Validating Event

Sure you can, but the Validating even it self will do nothing. You have to put the code inside of it, ok ?

Mitja

hmmmmmm Ok i will try
But Can you help me with different Examples not only this since i am new to C#