Hello,
I have a windows form with 2 datagrids on it.
How can I tell which datagrid is selected when a button is pushed?
I tried me.datagrid1.focus = true - but that was never triggered, regardless which datagrid had a selected cell in it.
TIA!
Amber
I've just build a windows form with two datagrids on it to check it out.... and the thing is that I think that when you select a cell or row, the focus it given to the cell or row therefore the datagrid isn't considered as focused.
I gave both datagrids a dataset as datasource, in run time, i filled the dataset with a simple table.
Now in the datagrid i can navigate to the table or "back to the parent rows" (little arrow on the top right corner of the datagrids). Well, if i navigate back to parent rows (up to the root), the datagrid i'm in is considered as focused.
To check that, i just put a button with some code to test if a datagrid is focused:
Code:
If DataGrid1.Focus Then
MsgBox("datagrid1 !!")
ElseIf DataGrid2.Focus Then
MsgBox("datagrid2 !!")
Else
MsgBox("No datagrid focused !!")
End If
Although this doesn't give you an answer I hope it will lead you to one.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.