Question Input String was not in a correct format?

ScottRobot

New member
Joined
Jul 31, 2008
Messages
1
Programming Experience
Beginner
VB.NET:
 Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Select Case m_blnAddNew
            Case True
                Dim newRow As DataRow
                Dim rowValues(9) As String

                rowValues(0) = txtID.Text
                rowValues(1) = txtLastName.Text
                rowValues(2) = txtFirstName.Text
                rowValues(3) = txtAddress1.Text
                rowValues(4) = txtAddress2.Text
                rowValues(5) = txtCity.Text
                rowValues(6) = txtState.Text
                rowValues(7) = txtZIP.Text
                rowValues(8) = txtPhone.Text
                rowValues(9) = txtEmail.Text


                newRow = DataSet11.Phonebook.Rows.Add(rowValues)

            Case False
                Dim intRowIndex As Integer = curMgrBooks.Position
                DataSet11.Tables("Phonebook").Rows(intRowIndex).EndEdit()
        End Select

        OleDbDataAdapter1.Update(DataSet11, "Phonebook")

        curMgrBooks.ResumeBinding()
        If m_blnAddNew = True Then
            curMgrBooks.Position = curMgrBooks.Count - 1
            UpdateRecordNumber()

        End If
        m_blnAddNew = False
    End Sub


k this is a part of my database program.. its simple; just adds, saves, deletes items in a database but i am having a problem...

i can change and save an existing row with no problems but when i click Add Row(which works), and try to save it brings up an error saying "System.FormatException: Input String was not in a correct format."
well that is part of what it says.. i dont believe the rest is necessary for fixing my problem.. if you can not find out the problem from this code alone ill add more..

thanks in advance
 
This normally happens when number or date parsing is happening and the string being parsed contains non numeric characters or is null or empty.
 
Back
Top