By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,695 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,695 IT Pros & Developers. It's quick & easy.

Parse / textBox.Text question

P: n/a
When I code

Double.Parse(textBox1.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
ng****@freeler.nl
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
mk
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

-----Original Message-----
When I code

Double.Parse(textBox1.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
ng****@freeler.nl
.

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.