- DataGridView - Placed in Form - 2
- TextBox1 - Placed in Form - 1
I want to access Data Grid View Row and Column value in Form - 1 and display in textbox.
I'm writing this code below:
Form2 form2 = new Form2();
DataGridView data = new DataGridView();
data = form2.qualitySetupDataGridView;
MessageBox.Show(data.Rows[0].Cells[1].Value.ToString());
Error Message: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Note: DataGridView Modifiers is set to public. I have 3-4 Records in the DataGridView that is placed in form-2.