If the problem is in the CurrentCellChanged, then the grid is already initialized.
Events in the DataGridView are often triggered in strange circumstances.
I suppose that there is no CurrentRow when the event is triggered. This can happen sometimes, such as when you are deleting the last row in the grid.
You can check to make sure that CurrentRow is available before trying to get its index:
Code:
Private Sub CARD_CATALOGDataGridView_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CARD_CATALOGDataGridView.CurrentCellChanged
If CARD_CATALOGDataGridView.CurrentRow IsNot Nothing Then
Dim i As Integer = CARD_CATALOGDataGridView.CurrentRow.Index
txtCallnumber.Text = CARD_CATALOGDataGridView.Item(13, i).Value
txtCallnumber.Text = txtCallnumber.Text.Replace(Chr(32), Chr(13) + Chr(10))
End If
End Sub
Bookmarks