I am trying to convert a String from a Textbox to a Long Integer. I've tried everything I can think of. Thanks in advance. Here's the error I get:
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 553: Dim getSerial As TextBox = e.Item.Cells(5).Controls(0)
Line 554: Dim iIdNumber as TableCell = e.Item.Cells(0)
Line 555: Dim intID as Long = Convert.ToInt64(iIdNumber.Text)
Line 556: Dim strPC As String = UCase(getPC.Text)Line 557: Dim strSerial As String = getSerial.Text
... and here's the code:
Sub dgrd_application_Update(sender As Object, e As DataGridCommandEventArgs)
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 553: Dim getSerial As TextBox = e.Item.Cells(5).Controls(0)
Line 554: Dim iIdNumber as TableCell = e.Item.Cells(0)
Line 555: Dim intID as Long = Convert.ToInt64(iIdNumber.Text)
Line 556: Dim strPC As String = UCase(getPC.Text)Line 557: Dim strSerial As String = getSerial.Text
... and here's the code:
Sub dgrd_application_Update(sender As Object, e As DataGridCommandEventArgs)
Dim getPC As TextBox = e.Item.Cells(4).Controls(0)
Dim getSerial As TextBox = e.Item.Cells(5).Controls(0)
Dim iIdNumber as TableCell = e.Item.Cells(0)
Dim intID as Long = Convert.ToInt64(iIdNumber.Text)
Dim strPC As String = UCase(getPC.Text)
Dim strSerial As String = getSerial.Text
Dim getSerial As TextBox = e.Item.Cells(5).Controls(0)
Dim iIdNumber as TableCell = e.Item.Cells(0)
Dim intID as Long = Convert.ToInt64(iIdNumber.Text)
Dim strPC As String = UCase(getPC.Text)
Dim strSerial As String = getSerial.Text
' CONNECT TO DATABASE...
objConnection = New OledbConnection(strConnection)
objConnection.Open()
objConnection = New OledbConnection(strConnection)
objConnection.Open()
strSQL = "UPDATE SQA SET PC = '" & strPC & "', SerialNo = '" & strSerial & "' WHERE ID = " & intID
' UPDATE SQA TABLE...
objCommand = New OledbCommand(strSQL,objConnection)
objCommand.ExecuteNonQuery() objCommand = Nothing
objCommand = New OledbCommand(strSQL,objConnection)
objCommand.ExecuteNonQuery() objCommand = Nothing
' DISCONNECT FROM DATABASE...
objConnection.Close() objConnection = Nothing dgrd_application.EditItemIndex = -1
BindData()
End SubobjConnection.Close() objConnection = Nothing dgrd_application.EditItemIndex = -1
BindData()