Hi i have problem in this code it says “Object reference not set to an instance of an object.”
i have a textbox for search,a datagridview and 7 textboxes for the items info.
if i type the word in search texboxes and the datagridview shows the match item but when i clicked the datagridview it shows the error..
Private Sub Supplies_RegularDataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Supplies_RegularDataGridView1.CellClick
Supplies_RegularDataGridView1.Rows(e.RowIndex).Selected = True
Dim i = Supplies_RegularDataGridView1.CurrentRow.Index
TextBox1.Text = Supplies_RegularDataGridView1.Item(1, i).Value.ToString()
TextBox2.Text = Supplies_RegularDataGridView1.Item(2, i).Value.ToString()
TextBox3.Text = Supplies_RegularDataGridView1.Item(3, i).Value.ToString()
TextBox4.Text = Supplies_RegularDataGridView1.Item(4, i).Value.ToString()
TextBox5.Text = Supplies_RegularDataGridView1.Item(5, i).Value.ToString()
TextBox14.Text = Supplies_RegularDataGridView1.Item(6, i).Value.ToString()
TextBox6.Text = Supplies_RegularDataGridView1.Item(7, i).Value.ToString() =the error here
End Sub
Supplies_RegularDataGridView1.Item(7, i).Valueis nullin c# you may do the following: