hi there,

i have a tab control with 3 tab in a form in C#.NET, and also i have a button which shold be doign adding rows to the datagrid view. how can i code the button so that when the active tab is tab on to add a row to it datagrid view, how can i do this,

thanx
appriciate a lot

Recommended Answers

All 5 Replies

Use the SelectedIndex property of the tab control to identify the current tab.
Or use the SelectedTab property to directly access the current TabPage.

any one out there

Use the SelectedIndex property of the tab control to identify the current tab.
Or use the SelectedTab property to directly access the current TabPage.

hey but when i used the code below only the Message box Topic Action will be running.y is that
the else part does not run at all

hey any solution

thanxxx

private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl1.TabIndex == 0)
            {
                MessageBox.Show("Topic Action");
            }
            else
                MessageBox.Show("nothing");
        }

The TabIndex property is the UI Tab order index not the selected tab of the TabControl.
Use tabControl1.SelectedIndex == 0

what is active tab index property in java script? i want to get active tab index value in java script

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.