When I create a tabpage at runtime how can I call that same tabpage at a different runtime sequence? SelectedTab = "newPage"
? newPage is not a collection I made at design time so it's not a part of collections. newPage is created only at runtime. It's for a Windows Form program Visual studio 2010
Thanks in advance and I hope you can help.
Don't have Visual Studio installed on my system yet, waiting for IT guys....but will try for a quick pointer.
TabPage tp = new TabPage();
tp.Name="MyTabPage";
tabControl.Controls.Add(tp);
To select your tabpage, you need to refer "tp"(tabPage variable) but NOT "MyTabPage"(name of tabpage).
tabControl1.SelectedTab = tp;
If they are being used in different methods or classes, try to use the properties. Hope it helps.
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.