I'm trying to update data in my excel database but it keeps giving me an error "Cannot covert from string "" to integer". I guess there is something wrong with it as I am not good with vb.net. I'm using an excel database. Only the first combox1 part is working without any error.
Dim AreaCode As String
Dim x As Integer
MsgBox("Do you want to update the records?")
If ComboBox1.SelectedIndex.Equals(0) Then
Try
AreaCode = ACTextBox.Text
DataGridView.Rows.Item(x).Cells(0).Value = ACTextBox.Text
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End If
Dim MetropolitanArea As String
If ComboBox1.SelectedIndex.Equals(1) Then
Try
MetropolitanArea = MATextBox.Text
DataGridView.Rows.Item(x).Cells(1).Value = ACTextBox.Text
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End If
Dim AnnualFixedArea As Integer
If ComboBox1.SelectedIndex.Equals(2) Then
Try
AnnualFixedArea = AFCTextBox.Text
DataGridView.Rows.Item(x).Cells(2).Value = AFCTextBox.Text
Catch ex As Exception
End Try
End If
Dim WagePerHour As String
If ComboBox1.SelectedIndex.Equals(3) Then
Try
WagePerHour = TextBoxWPH.Text
DataGridView.Rows.Item(x).Cells(3).Value = TextBoxWPH.Text
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End If
End Sub