473,490 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form as a TabPage?

Hi everyone,

I have a tabcontrol on a form that contains 4 tabs. I want to make
each tab a seperate form because there is a great deal of code behind
each page, and organizationally it was easier to have each one
seperate. My idea was to just add and remove each form as necessary
based on what page the user clicked on, but I am getting an error when
I try to add the form as a tabpage:

Dim frm as new Form1
Me.tabMain.TabPages.Add(frm)

It is telling me that type form cannot be converted to type TabPage.
Any ideas???

Also, I'm still relatively new to vb.net, so I should also pose the
question: Am I doing this the proper way, or should I be doing this in
a different manner?

Thank you in advance for your insight!

Nov 21 '05 #1
2 2197
"GatorBait" <MP****@gmail.com> schrieb:
[...]


This is a double post. Please continue discussion in the other "instance"
of the thread.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Hi,

Not sure about this! When you say that you have a lot of 'code behind', does
this mean that you are programming asp.net? If so, then I am not very
familiar...sorry!

If you are coding for windows forms, then my next question is.....Do you
really need a 'Form' or do you just need a container for your other
controls? With the TabControl I usually use panels to add my controls to.

You code is slightly incorrect and the error message is understandable. What
you are actually doing is attempting to ad a control of type form when it is
expecting a control of type tabpage. You need to use
Me.tabMain.TabPages(index).Controls.Add(control). This will not work if you
try to add a form and I'm not sure that you can accomplish this........but
I'm sure there will be someone with a definite answer!

I hope this gives you something to work with.

Good luck. Phil

"GatorBait" <MP****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi everyone,

I have a tabcontrol on a form that contains 4 tabs. I want to make
each tab a seperate form because there is a great deal of code behind
each page, and organizationally it was easier to have each one
seperate. My idea was to just add and remove each form as necessary
based on what page the user clicked on, but I am getting an error when
I try to add the form as a tabpage:

Dim frm as new Form1
Me.tabMain.TabPages.Add(frm)

It is telling me that type form cannot be converted to type TabPage.
Any ideas???

Also, I'm still relatively new to vb.net, so I should also pose the
question: Am I doing this the proper way, or should I be doing this in
a different manner?

Thank you in advance for your insight!

Nov 21 '05 #3

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

Similar topics

6
32055
by: Sleepy | last post by:
Visual Studio 2003 Windows Forms application: Is there a way that I can add a form as a TabPage? My goal is to develop a series of forms and load the dialogs dynamically in a tab control based...
4
1679
by: Philip Wagenaar | last post by:
I have made a form with a tab that containts groupboxes and those contain checkboxes. When I run the application sometimes the outlining for some groupboxes are not shown, if I switch tabs and...
2
8080
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
1666
by: MLH | last post by:
I thought it was DoCmd.GoToPage - but that doesn't work for Tab Controls, it seems - only for forms with page breaks in them. Anybody know Syntax form moving from page-to-page (actually,...
8
3554
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
5
13266
by: Amit | last post by:
Can anyone write the code to hide tabpage of tab control in windows form 2.0 Thanks, Amit
12
2339
by: Rob | last post by:
Let's say you open Form1 that contains TabControl1 There are several tabs on TabControl1 Now you open a new Form2 that contains a User Control How can you determine the Selected tab in Form1...
6
12857
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello gurus, I want to have a Form with a TabControl, this TabControl will contain TabPage that has controls in it, this TabPage is prepared at design time. I want in runtime to duplicate the...
1
2003
by: RobcPettit | last post by:
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));...
0
6974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7183
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.