private void addNewToolStripMenuItem_Click(object sender, EventArgs e) // add a TabPage { foreach (TabPage t in RecipientsTab.Controls) { if (t.Name == "Not Set") { return; } } TabPage NewTab = new System.Windows.Forms.TabPage(); NewTab.Text = NewTab.Name = "Not Set"; RecipientUserCtrl content = new RecipientUserCtrl(NewTab); content.DeviceAddrOK += new Action <RecipientUserCtrl, bool>(content_DeviceAddrOK); NewTab.Controls.Add(content); RecipientsTab.Controls.Add(NewTab); RecipientsTab.SelectTab("Not Set"); labelEmpty.Visible = false; content.Device.Text = comm.GetStringMac(); content.Device.ForeColor = Color.Gray; }