G
Guest
Hi all,
I'm looking for a little help in determining what's causing this exception.
I'm getting it when running VB.NET apps developed in VS 2005 (.NET 2.0). It
doesn't appear to matter under what context the conversion takes place -
whether it's implicit or explicitly cast - it barfs either way. The source
of the string "0" doesn't appear to matter either...whether it's from a text
box, data grid, or simply coded directly, it throws the exception every time.
The following will fail, for example (option strict: off)...
Dim s As String = "0"
Dim i As Integer
i = s
The problem is specific to my machine and 1 other colleague's...it works
fine for everybody else. Furthermore, running a VB.NET app developed in VS
2003 (.NET 1.1) from my machine does NOT produce the error. I tried
re-installing the 2.0 framework, but still get the exception. Full text of
the exception from the above code follows...
System.InvalidCastException: Conversion from string "0" to type 'Integer' is
not valid. ---> System.FormatException: Input string was not in a correct
format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String
Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String
Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String
Value)
at TestInt0.Form1.Button1_Click(Object sender, EventArgs e) in
C:\VS_Temp\TestInt0\TestInt0\Form1.vb:line 36
Any help would be much appreciated! Thanks so much!
Steve
I'm looking for a little help in determining what's causing this exception.
I'm getting it when running VB.NET apps developed in VS 2005 (.NET 2.0). It
doesn't appear to matter under what context the conversion takes place -
whether it's implicit or explicitly cast - it barfs either way. The source
of the string "0" doesn't appear to matter either...whether it's from a text
box, data grid, or simply coded directly, it throws the exception every time.
The following will fail, for example (option strict: off)...
Dim s As String = "0"
Dim i As Integer
i = s
The problem is specific to my machine and 1 other colleague's...it works
fine for everybody else. Furthermore, running a VB.NET app developed in VS
2003 (.NET 1.1) from my machine does NOT produce the error. I tried
re-installing the 2.0 framework, but still get the exception. Full text of
the exception from the above code follows...
System.InvalidCastException: Conversion from string "0" to type 'Integer' is
not valid. ---> System.FormatException: Input string was not in a correct
format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String
Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String
Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String
Value)
at TestInt0.Form1.Button1_Click(Object sender, EventArgs e) in
C:\VS_Temp\TestInt0\TestInt0\Form1.vb:line 36
Any help would be much appreciated! Thanks so much!
Steve