private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.RowIndex < URLs.Count) { foreach(TabPage tpg in tabControl1.TabPages) { if(tpg.Text == ((ShellURL)URLs[e.RowIndex]).URL) return; } ShellUserControl suc = new ShellUserControl((ShellURL)URLs[e.RowIndex]); suc.Dock = DockStyle.Fill; TabPage tp = new TabPage(((ShellURL)URLs[e.RowIndex]).URL); tp.Controls.Add(suc); tabControl1.TabPages.Add(tp); tabControl1.SelectedTab = tp; } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.RowIndex < URLs.Count) { foreach (TabPage tpg in tabControl1.TabPages) { if (tpg.Text == ((ShellURL)URLs[e.RowIndex]).URL) { return; } } ShellUserControl suc = new ShellUserControl((ShellURL)URLs[e.RowIndex]); suc.Dock = DockStyle.Fill; TabPage tp = new TabPage(((ShellURL)URLs[e.RowIndex]).URL); tp.Controls.Add(suc); tabControl1.TabPages.Add(tp); tabControl1.SelectedTab = tp; } }