Hi, I have two forms. From form1(frmMain) I want to add tabpages to
Form2. In form1 I have:
frmMain tbe = new frmMain();
Thread thread = new Thread(new
ThreadStart(tbe .AddTab));
thread.IsBackgr ound = true;
thread.Start();
In Form2 I have:
public delegate void mydata(String e);
public void AddTab()
{
if (this.InvokeReq uired)
{
this.BeginInvok e(new mydata(TestMeth od),"somestring ");
}
else
{
TestMethod("rob ");
}
}
private void TestMethod(Stri ng mystring)
{
String TabName = "rob";
TabPage NewTab = new TabPage(TabName );
tabControl1.Tab Pages.Add(NewTa b);
}
It biulds ok, and runs ok, but doesnt show the tabs on Form2.
The idea is that both forms are open, from form one I scan through a
list which has been added to a treeview,(this all works). Then click
the item I want, creating a new tab in form2 each time. Then close
form1 and work with form2.
Regards Robert
Form2. In form1 I have:
frmMain tbe = new frmMain();
Thread thread = new Thread(new
ThreadStart(tbe .AddTab));
thread.IsBackgr ound = true;
thread.Start();
In Form2 I have:
public delegate void mydata(String e);
public void AddTab()
{
if (this.InvokeReq uired)
{
this.BeginInvok e(new mydata(TestMeth od),"somestring ");
}
else
{
TestMethod("rob ");
}
}
private void TestMethod(Stri ng mystring)
{
String TabName = "rob";
TabPage NewTab = new TabPage(TabName );
tabControl1.Tab Pages.Add(NewTa b);
}
It biulds ok, and runs ok, but doesnt show the tabs on Form2.
The idea is that both forms are open, from form one I scan through a
list which has been added to a treeview,(this all works). Then click
the item I want, creating a new tab in form2 each time. Then close
form1 and work with form2.
Regards Robert
Comment