Been out of program for long time. Just learning VB 2008 and things have changed since 1999.
I have 3 Datagrids. I want to group all 3 row clicks into one area and get the CurrentRowIndex.
So can you pass a control name to get CurrentRowIndex of the 3 grid?
I know this does not work:
private void tblCollectionDataGrid_Click(object sender, EventArgs e)
{
Control control = (Control)sender;
MessageBox.Show(control.Name);
row = control.Name.CurrentRowIndex;
}
or do you have to type each one out? This works but ... want it simpler if possible.
private void tblCollectionDataGrid_Click(object sender, EventArgs e)
{
Control control = (Control)sender;
MessageBox.Show(control.Name);
switch (control.Name)
{
case "tblMemoDataGrid":
row = tblMemoDataGrid.CurrentRowIndex;
break;
case "tblReportDataGrid":
row = tblReportDataGrid.CurrentRowIndex;
break;
case "tblInfoDataGrid":
row = tblInfoDataGrid.CurrentRowIndex;
break;
}
}