New Tab generieren für Browser!
-
Hallo,
ich möchte einen neuen Tab generieren ohne am anfangpublic partial class Form1 : Form { :arrow_right: private TabPage tabPage2;
davon 50 oder 60 stück zu machen wie könnte ich das machen.
Es soll immer wenn Button1 gekickt wird wird ein neuer Tab generiert werden...
Mein Code:namespace Browser { public partial class Form1 : Form { private TabPage tabPage2; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.tabPage2 = new TabPage(); // Gets the controls collection for tabControl1. // Adds the tabPage1 to this collection. this.tabControl1.TabPages.Add(tabPage2); tabControl1.SelectedTab = tabControl1.TabPages[2]; } } }
mfg
---C#
-
namespace Browser { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { TabPage tabPage = new TabPage(); // Gets the controls collection for tabControl1. // Adds the tabPage1 to this collection. this.tabControl1.TabPages.Add(tabPage); } } }
So sollte ein Schuh draus werden.
-
Danke Firefighter
Jetzt fehlt nur noch das focusieren des neuen Tabsmfg
---c#
-
Das bekommst du doch aber nun allein hin?
-
Kleiner Tip. Du machst es genauso wie bei dir oben, nur das du den eben erzeugten Tab verwendest
-
Aber
tabControl1.SelectedTab = tabControl1.TabPages[TabPage];
funktioniert nicht
-
Ich bitte dich!
Das hatte ich nicht gesagt.namespace Browser { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { TabPage tabPage = new TabPage(); // Gets the controls collection for tabControl1. // Adds the tabPage1 to this collection. this.tabControl1.TabPages.Add(tabPage); this.tabControl1.SelectedTab = tabPage;//!!!!!!!!! } } }
-
Geht noch immer nicht...
Woran liegt das?
Hilfe büdde
-
---c# schrieb:
Geht noch immer nicht...
Und was geht nicht?
-
Doch muss gehen, oder du machst woanders etwas falsch.
http://msdn.microsoft.com/de-de/library/system.windows.forms.tabcontrol.selectedtab.aspx
-
Solange nicht gezeigt wird wie es probiert wurde, oder zumindest etwas Eigeninitiative zu erkennen ist würde ich hier nicht helfen.
-
Sry das war ich nicht es geht!
Danke
mfg
---C#
-
Sorry wegen doppelpost aber ich will mich nochmal bedanken und ich habe gelernt
namespace WindowsFormsApplication3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { WebBrowser webBrowser = new WebBrowser(); TabPage tabPage = new TabPage(); // Gets the controls collection for tabControl1. // Adds the tabPage1 to this collection. this.tabControl1.TabPages.Add(tabPage); this.tabControl1.SelectedTab = tabPage; tabPage.Controls.Add(webBrowser); webBrowser.Dock = DockStyle.Fill; webBrowser.Navigate(new Uri("http:\\\\google.de")); } } }
Ich habe einfach probiert das ganze nochmal umzusetzten und es hat geklappt danke
mfg
---C#
-
es heisst:
http://google.de
und nicht
http:\\google.de