uzi42tmp
uzi42tmp

Reputation: 291

Winforms insert Tab into Tab Control at right place

I'm working with Windows Forms and put a Tab Control into my Form. I have already put some Buttons etc into the first tab and some other code. The problem that I have is the following:

I want to insert a Tab on the first place of the Tab Control but everytime I insert a new Tab he puts it at the end. How can I move the Tab without changing my code? I'm wondering because he made functions like

private void tabPage1_Click(object sender, EventArgs e)
    {

    }

but my code is beyond this function and I can't even insert it into it.

Upvotes: 1

Views: 3060

Answers (3)

Rohit
Rohit

Reputation: 1550

you can use this:

myTabCtrl.TabPages.Insert(0, "newTab");

Upvotes: 2

ASh
ASh

Reputation: 35646

TabControl has collection property TabPages

if you open editor of this property in winforms designer, you will see buttons with arrow up and arrow down in the central part of editor form

click them to change the order of tab pages

Upvotes: 3

Rohit Prakash
Rohit Prakash

Reputation: 1973

Use insert function for 0 index.

tabControl1.TabPages.Insert(0, "newTab");

Upvotes: 4

Related Questions