Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In my WinForm TabControl in TabControl three Tab & botton the name of Botton 'Next' When click the Botton go to Next Tab
How ?
Are form Indax TabPage ???



Note: The Botton in Winform & out TabCotrol.
Posted

See TabControl.SelectedIndex at MSDN[^] All your button needs to do is read this, check it against the number of tab pages, increment if necessary, and write it back.
 
Share this answer
 
Comments
Espen Harlinn 9-Jan-11 10:22am    
5+ Nice and simple
you can change your tab by click on button as you wish by using given code
C#
int i = 0;
        private void btnext_Click(object sender, EventArgs e)
        {
            if (i <= 3)  //using 3 A/c to your question you can change it
            {
                tabControl1.SelectedIndex = i;
                tabControl1.TabPages[i].Parent.Focus();
                i++;    // Increase counter
            }
            else
            {
             //you Message
            }
        }
 
Share this answer
 
v3
Comments
Sandeep Mewara 10-Jan-11 3:23am    
[Off topic] : You posted this as a comment to me:"Take a look of HirenSolanki Answer. he is just refer a Link which is 100% matching with your answer. you can also refer this link without using complete code as well as sentence which mentioned there."

Kindly take a look at the timing. It was almost at the same time when I replied. Infact, Hiren, Ankur and me were replying simultaneously. It's just that I posted code as I had that in my app and Hiren posted link. Hope that can be spared! :)

If you still find it wrong, do tell me.
RaviRanjanKr 10-Jan-11 11:50am    
oh my god it my apologies I haven't read your comment. but why you commented here. you should commented at http://www.codeproject.com/Questions/144418/Application-to-be-started-at-startup.aspx.
please forgive me I am taking you wrong.
I feel very guilty please forgive me.
you can use this code

C#
private void btnNext_Click(object sender, EventArgs e)
        {
            int NumIndex = tabControl1.SelectedIndex;
            if (NumIndex < tabControl1.TabPages.Count-1)
            {
                tabControl1.SelectTab(NumIndex + 1);
            }
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900