Search code examples
c#winformsdatagridviewtabsdatagridviewcolumn

c# winform datagridview cell click to TabControl Page


i want to implement a function that can

click on the datagridview's cell/columns than will switch to Tab page

any idea on it ?

like these picture

pic one is the total result on Tab 1 and Tab2, when i click on cell/column

switch to Tab1 or Tab2 to see the details


Solution

  •     private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            // check if you are clicking on needed column
            // and focus the tab
            if (e.ColumnIndex == 1) tabControl1.SelectedTab = tabPage2;
        }