4
Contributors
11
Replies
12
Views
6 Years
Discussion Span
Last Post by rikiroxs
Featured Replies
  • 2
    ddanbe 2,625   6 Years Ago

    Why is it so urgent? Is your house on fire? [COLOR="Red"]Don't post a message here in red.[/COLOR] 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. Read More

  • 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: [CODE] private void button1_Click(object sender, EventArgs e) { string sValue = textBox1.Text; int intValue = 0; decimal decValue … Read More

  • 1
    ddanbe 2,625   6 Years Ago

    hmmm did you check these out(among others) in the code snippet section? [url]http://www.daniweb.com/code/snippet217265.html[/url] [url]http://www.daniweb.com/code/snippet217310.html[/url] Read More

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.

Edited by ddanbe: typo

1

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

0

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

Mitja

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.