Home All Groups Group Topic Archive Search About

System.Convert.ToInt64(String) method exception

Author
23 Mar 2007 3:22 PM
David Lowe
This statement (txtNewOdometer is a variable for an edit box):

lSN = System.Convert.ToInt64(txtNewOdometer.Text);

is causing an exception iff a zero ('0') is entered into the textbox.  But
only on one user's computer; works fine on everyone elses.

The exception's Message is "Input string was not in a correct format."

Does anyone have any idea whatsoever on what could be happening, or what
further steps I can take to analyze this problem?

Any help greatly appreciated!

Author
23 Mar 2007 4:54 PM
VJ
you have a stack Trace of the exception?

VJ

Show quote
"David Lowe" <DavidL***@discussions.microsoft.com> wrote in message
news:CC90BC2F-571A-4458-8BDD-E7C7B595B9D1@microsoft.com...
> This statement (txtNewOdometer is a variable for an edit box):
>
> lSN = System.Convert.ToInt64(txtNewOdometer.Text);
>
> is causing an exception iff a zero ('0') is entered into the textbox.  But
> only on one user's computer; works fine on everyone elses.
>
> The exception's Message is "Input string was not in a correct format."
>
> Does anyone have any idea whatsoever on what could be happening, or what
> further steps I can take to analyze this problem?
>
> Any help greatly appreciated!
Author
25 Mar 2007 11:43 PM
PS
"David Lowe" <DavidL***@discussions.microsoft.com> wrote in message
news:CC90BC2F-571A-4458-8BDD-E7C7B595B9D1@microsoft.com...
> This statement (txtNewOdometer is a variable for an edit box):
>
> lSN = System.Convert.ToInt64(txtNewOdometer.Text);

Use the TryParse method on Int64.

PS

Show quote
>
> is causing an exception iff a zero ('0') is entered into the textbox.  But
> only on one user's computer; works fine on everyone elses.
>
> The exception's Message is "Input string was not in a correct format."
>
> Does anyone have any idea whatsoever on what could be happening, or what
> further steps I can take to analyze this problem?
>
> Any help greatly appreciated!

AddThis Social Bookmark Button