Parse / textBox.Text question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patrick De Ridder

    #1

    Parse / textBox.Text question

    When I code

    Double.Parse(te xtBox1.Text)

    I get an error

    How can I convert a text box entry to a numeric?

    Please give a code example, if you know the answer.

    --
    Patrick De Ridder
    ngmail@freeler. nl
  • mk

    #2
    Parse / textBox.Text question

    Hi,
    You should only receive an error when the Text property
    is null, or is not a number, for example "1" will parse
    correctly, "" or "Not a number" will not.
    I would suggest that you wrap your Double.Parse statement
    in try/catch and check for an error that states something
    like 'the input string was an incorrect format', etc.

    HTH,

    Martin

    [color=blue]
    >-----Original Message-----
    >When I code
    >
    >Double.Parse(t extBox1.Text)
    >
    >I get an error
    >
    >How can I convert a text box entry to a numeric?
    >
    >Please give a code example, if you know the answer.
    >
    >--
    >Patrick De Ridder
    >ngmail@freeler .nl
    >.
    >[/color]

    Comment

    Working...