casting not working on host machine

  • Thread starter Thread starter barry
  • Start date Start date
B

barry

What follows works fine on my localhost when I test it but migrating to my
web host gives me an error


The line of code is:
poly1a.employeeID = CInt(TextBox1.Text)

The error message is "Input string was not in a correct format."

1. have option strict on
2. The employeeID is a property defined as an integer
3. Caste the textbox1.text as integer

Any help would be appreciated
 
Barry,

This can when there is a non numeric value (which may include currency
signs, comma's, decimal points and numeric representations) in your textbox.

So the simplest test before this is
\\\
IF IsNumeric(TextBox1.Text) then
///
I hope this helps?

Cor
 
barry said:
What follows works fine on my localhost when I test it but migrating to my
web host gives me an error

The line of code is:
poly1a.employeeID = CInt(TextBox1.Text)

The error message is "Input string was not in a correct format."

\\\
Imports System.Globalization
..
..
..
Dim i As Integer
Dim d As Double
If _
Double.TryParse( _
Me.TextBox1.Text, _
NumberStyles.Integer, _
Nothing, _
d _
) _
Then
i = CInt(d)
End If
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top