473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

adding tabpage to another form

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.IsBackground = true;
thread.Start();

In Form2 I have:
public delegate void mydata(String e);

public void AddTab()
{
if (this.InvokeRequired)
{
this.BeginInvoke(new mydata(TestMethod),"somestring");
}

else
{
TestMethod("rob");
}

}
private void TestMethod(String mystring)
{
String TabName = "rob";
TabPage NewTab = new TabPage(TabName);
tabControl1.TabPages.Add(NewTab);
}

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
Dec 13 '07 #1
1 2001
Thankyou for your reply. Both forms are showing. Do you meen the
reference on the form that I want to add the tab to. If so do I have
to refer to form2 even though the code is in form2.

Regards Robert
Dec 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JG | last post by:
Hi, I have a windows form with a TabControl on it. It has 3 tabpages on it. I have also coded a button that is supposed to 'add' a new tabpage. The code in that clicked event looks like this:...
1
by: RA | last post by:
Hi 1) I want to create a TabPage class in design mode - how do I do it? What type of project should I use? Is it going to be a custom control? 2) I have a TabControl that I would like to add to...
4
by: slylos | last post by:
I've got a Windows form that has a TabControl. I add TabPages to this TabControl at Runtime, along with two Textboxes and a button. The problem I'm having is I can't figure out how to reference...
6
by: Stan Sainte-Rose | last post by:
Hi, I've a Tabcontrol and I 'd like to disable a tabpage I try to use the hide and visible property but it doesn't work. Thx Stan
3
by: Tom McL. | last post by:
My Program has two forms From1 and Form2. On From1 I have a TabControl1 witch has 8 tabs currently. I would like to add a new tab from Form2 is this possible? I have tried the following code on...
2
by: TN | last post by:
I can add a button to a TabPage, how come I can't add a Form? The Form never gets realized on the page, but a button can :-( f = new System.Windows.Forms.Form(); b = new Button(); b.Text =...
1
by: Ingo Beyer | last post by:
Hello, I created a windows form with vs.net 2005 / c#. This control has a TabControl with 16 TabPages. On every TabPage there are a diffrent number of Controls. - Every TabPage has a background...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
0
by: mustividyavtahi | last post by:
I am developing a windows application using c# in that i used tabcontrol in MDI form to display the child forms. that is working fine. but my problem is when i click a button in that tabpage (child...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.