On top datagridview
I have 4 datagridviews. based on user's selection I'll bring on of them to front. I have a button that use top datagridview for calculating something. How can I recognize which datagridview开发者_运维百科 is on top?
Use .Visible = true;
or .Visible = false;
Property to either hide or show your current grid, thus you can identify which one is on top by checking the .Visible
foreach(Control c in this.Controls)
{
if (c is DataGridView && c.Visible)
{
//Do your logic here
}
}
take a global variable. when you move first datagrid then set value of global variable to 'one'(or any other so you can identify that this is first datagrid) and for second datagrid 'two' like for other datagrids also. While calculation based on the variable value you can do appropriate actions
精彩评论