简体   繁体   中英

How to save settings a TabControl with new TabPages? Visual Studio and C#

Add new pages:

private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
    TabPage mytab = new TabPage();
    mytab.Text = "New Tabpage";
    tabControl2.TabPages.Add(mytab);
}

How to save settings for new tabpages in Form. I want to keep the new added tabs but I can not make them stay

All you really need to know is the number of TabPages and, perhaps, the Text for each one. In that case, all you need is either a single int or else a StringCollection in settings. If you use a StringCollection , you'd loop through it and create a TabPage for each item when loading and loop through the TabPages and add an item when saving.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM