bool IsOpenedBefore(TabPageType tpgtype, string p = "") { bool checkid = (p != ""); // prevent duplicated tabpages foreach (TabPage t in tabControl1.TabPages) { if (t.ToolTipText.ToLower().Trim() == tpgtype.ToString().ToLower().Trim()) { if (checkid == false) { return(true); } else { if (t.Name == p || t.Text == p) { return(true); } } } } return(false); }
public int BrotherIndex(TabPageType tpgtype) { // prevent duplicated tabpages int i = 0; foreach (TabPage t in tabControl1.TabPages) { if (t.ToolTipText.ToLower() == tpgtype.ToString().ToLower()) { return(i); } i++; } return(-1); }