C# help with getting stuff to populate
Right I have this peace of code. I want it duplicate the textBox, and at the same time, I want them to appear on other tabs in a multidimensional array, I know there is a way of doing it, but I just dont have a bloody clue where to go it has had me perplexed most for over a week now. Any help would be appreciated
private void button1_Click(object sender, EventArgs e)
string title = "Round " + (tabControl1.TabCount + 1).ToString();
TabPage myTabPage = new TabPage(title);
tabControl1.SelectedIndex = tabControl1.TabCount;
textBox9.Parent = tabControl1.TabPages[tabControl1.SelectedIndex];
label9.Parent = tabControl1.TabPages[tabControl1.SelectedIndex];
IIRC, you need to add the TextBox and Label controls to the Controls member of your TabPage... myTabPage.Controls.Add(...);
This: textBox9.Parent = tabControl1.TabPages[tabControl1.SelectedIndex];
... looks like it can be simplified to this: textBox9.Parent = myTabPage;
If you're just setting the parent to a specific TextBox though then you're not duplicating anything. Same thing with that Label. Although pionting that out, this won't work anyways unless you use tabControl1.TabCount - 1, becuase the indexing is 0 based...
|All times are GMT +1. The time now is 06:03 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.