I'm not sure if I have the right concept going. I am making a custom TabPage and executing it from a button click event. It works fine I'm just thinking I might be missing the finer points of the c# language. If not maybe I'm starting to catch on. Would like comments...bett er???...simpler ???...
Here is the code....
tia
meh
// Build New Tab Page
//
string title = "tabPage" + (tabControl1.Ta bCount + 1).ToString();
TabPage myTabPage = new TabPage(title);
tabControl1.Tab Pages.Add(myTab Page);
//
// Build New tabPage with treeView1
//
TreeView CurrTree = new TreeView();
CurrTree.Dock = System.Windows. Forms.DockStyle .Fill;
CurrTree.ImageI ndex = -1;
CurrTree.Indent = 19;
CurrTree.ItemHe ight = 16;
CurrTree.Locati on = new System.Drawing. Point(0, 44);
CurrTree.Name = "CurrTree" + (tabControl1.Ta bCount).ToStrin g();
CurrTree.Select edImageIndex = -1;
CurrTree.Size = new System.Drawing. Size(292, 428);
CurrTree.TabInd ex = 3;
// Adds new node as a child node of the currently selected node.
TreeNode newNode = new TreeNode();
newNode.Text = "Text for new node";
newNode.ImageIn dex = 0;
newNode.Selecte dImageIndex = 1;
CurrTree.Nodes. Add(newNode);
CurrTree.Select edNode = newNode;
//
// Build New tabPage with myComboBox
//
ComboBox myComboBox = new ComboBox();
myComboBox.Dock = System.Windows. Forms.DockStyle .Top;
myComboBox.Item Height = 13;
myComboBox.Loca tion = new System.Drawing. Point(0, 23);
myComboBox.Name = "comboBox" + (tabControl1.Ta bCount).ToStrin g();
myComboBox.Size = new System.Drawing. Size(292, 21);
myComboBox.TabI ndex = 2;
myComboBox.Text = "comboBox" + (tabControl1.Ta bCount).ToStrin g();
//
myTabPage.Contr ols.Add(CurrTre e);
myTabPage.Contr ols.Add(myCombo Box);
//
// keep the toolbar
myTabPage.Contr ols.Add(tabTool Bar);
//
//
tabControl1.Sel ectedTab = myTabPage;
myTabPage.Text = CurrTree.Name;
statusBar1.Pane ls[0].Text = myTabPage.Text;
// tabToolBar.Brin gToFront();
break;
Here is the code....
tia
meh
// Build New Tab Page
//
string title = "tabPage" + (tabControl1.Ta bCount + 1).ToString();
TabPage myTabPage = new TabPage(title);
tabControl1.Tab Pages.Add(myTab Page);
//
// Build New tabPage with treeView1
//
TreeView CurrTree = new TreeView();
CurrTree.Dock = System.Windows. Forms.DockStyle .Fill;
CurrTree.ImageI ndex = -1;
CurrTree.Indent = 19;
CurrTree.ItemHe ight = 16;
CurrTree.Locati on = new System.Drawing. Point(0, 44);
CurrTree.Name = "CurrTree" + (tabControl1.Ta bCount).ToStrin g();
CurrTree.Select edImageIndex = -1;
CurrTree.Size = new System.Drawing. Size(292, 428);
CurrTree.TabInd ex = 3;
// Adds new node as a child node of the currently selected node.
TreeNode newNode = new TreeNode();
newNode.Text = "Text for new node";
newNode.ImageIn dex = 0;
newNode.Selecte dImageIndex = 1;
CurrTree.Nodes. Add(newNode);
CurrTree.Select edNode = newNode;
//
// Build New tabPage with myComboBox
//
ComboBox myComboBox = new ComboBox();
myComboBox.Dock = System.Windows. Forms.DockStyle .Top;
myComboBox.Item Height = 13;
myComboBox.Loca tion = new System.Drawing. Point(0, 23);
myComboBox.Name = "comboBox" + (tabControl1.Ta bCount).ToStrin g();
myComboBox.Size = new System.Drawing. Size(292, 21);
myComboBox.TabI ndex = 2;
myComboBox.Text = "comboBox" + (tabControl1.Ta bCount).ToStrin g();
//
myTabPage.Contr ols.Add(CurrTre e);
myTabPage.Contr ols.Add(myCombo Box);
//
// keep the toolbar
myTabPage.Contr ols.Add(tabTool Bar);
//
//
tabControl1.Sel ectedTab = myTabPage;
myTabPage.Text = CurrTree.Name;
statusBar1.Pane ls[0].Text = myTabPage.Text;
// tabToolBar.Brin gToFront();
break;
Comment