المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Open new tab that not exist



C# Programming
08-07-2009, 03:44 PM
Hi,
I've a tab control that has for ex. 2 members at the TabPages.
The first calles "one and the other "second".
i want to check if at my TabPages i have already a tab with some name
and if not' i want to add new one with that name.

this is my foreach loop:

foreach (TabControl item in tabControl1.TabPages)


and this my my code to add new tab:

TabPage tab = new TabPage();
RichTextBox document = new RichTextBox();
document.Dock = DockStyle.Fill;
document.ReadOnly = true;
tab.Controls.Add(document);
tab.Text = "one";
tabControl1.TabPages.Add(tab);




Someone have an idea how to do this?