I have a TAB where a data grid gets displayed. I want to access the elements of the datagrid.
but i'm getting the following error. "Data cannot be read from a DataGrid which is not bound to a DataTable".
But the thing is, in the TAB where the data grid gets displayed, i have kept a button (btnTestCase), and i'm able to access the data grid values from this method.
Can u help me in resolving this issue. i need to access the values of the datagrid in the method "mnuTestGen_Click()" i.e after the method "Test()" which contains code for populating values in the data grid.
Here is the code of the two methods,
private void mnuTestGen_Click(object sender, System.EventArgs e) // by pragadheesh
{
Test(); //after this data grid gets loaded in the TAB
MessageBox.Show(dataGrid2[0,4].ToString()); //error here "Data cannot be read from a DataGrid which is not bound to a DataTable."
btnTestGen_Click();
}
private void btnTestCase_Click(object sender, EventArgs e)
{
MessageBox.Show(dataGrid2[0,4].ToString()); //NO error here
}
Thanks in advance.
Regards,
Pragadheeshwaran.T