user422481
user422481

Reputation: 49

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?

Upvotes: 0

Views: 92

Answers (2)

Rami Alshareef
Rami Alshareef

Reputation: 7140

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
  }
}

Upvotes: 1

deepi
deepi

Reputation: 1081

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

Upvotes: 1

Related Questions