473,882 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form as TabPage???

Hi everyone:

I have a form that has a tab control on it with 4 pages. There is a
lot of code behind each page as well as many controls on each page so I
decided to make each indidvidual page a seperate form, for organization
purposes. I am getting an error when I try to add the form to the tab
control. The error message tells me that the form cannot be converted
to type tabpage. Here is the code I am using:

Dim frm as new Form1
tabMain.TabPage s.Add(frm)

Does anyone have any ideas?

I should also mention that I am still pretty new to VB.NET so I wanted
to ask if I am doing this the proper way. Is there a different
methodology that I should be following?

Thank you in advance for your insight!

Nov 21 '05 #1
4 15187
"GatorBait" <MP****@gmail.c om> schrieb:
I have a form that has a tab control on it with 4 pages. There is a
lot of code behind each page as well as many controls on each page so I
decided to make each indidvidual page a seperate form, for organization
purposes. I am getting an error when I try to add the form to the tab
control. The error message tells me that the form cannot be converted
to type tabpage.


I suggest to use usercontrols instead of forms which should be embedded into
the tabcontrol. Choose "Project" -> "Add user control..." to add a
usercontrol to your project.

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

Nov 21 '05 #2
GatorBait wrote:
Dim frm as new Form1
tabMain.TabPage s.Add(frm)


Change your code to this:

Dim frm As new Form1
frm.TopLevel = False
frm.Parent = tabMain.TabPage s(0)

frm.Show()
The form should now be visible inside the tab page. You might want to
set the form's FormBorderStyle property to none.

Nov 21 '05 #3
Herfried K. Wagner [MVP] wrote:
I suggest to use usercontrols instead of forms which should be embedded into
the tabcontrol. Choose "Project" -> "Add user control..." to add a
usercontrol to your project.


Herfried, do you know if there is any technical reason not to use a
form? Both the Form class and UserControl class have the same
inheritance chain. And, of course, Form has other properties that
UserControl might not have.

I am just curious.

Nov 21 '05 #4
Chris,

"Chris Dunaway" <du******@gmail .com> schrieb:
I suggest to use usercontrols instead of forms which should be embedded
into
the tabcontrol. Choose "Project" -> "Add user control..." to add a
usercontrol to your project.


Herfried, do you know if there is any technical reason not to use a
form? Both the Form class and UserControl class have the same
inheritance chain. And, of course, Form has other properties that
UserControl might not have.


Forms are not designed for being embedded into other controls or forms,
except in MDI scenarios.

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

Nov 21 '05 #5

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

Similar topics

6
32134
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 on the user selection of a particular function. I would like to leverage the usefulness of the Form Designer to layout my dialogs and then load them into TabPages. I tried setting the TabPage as the Form.Parent and various other things; all
2
2219
by: GatorBait | last post by:
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
4
1716
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 back sometimes all outlining is shown and sometimes are not shown. I have no idea what is going wrong. What also is weird is that when I open the form from my main application I can resize the form, even though it is locked, and that when I cut...
2
8125
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 = "Hello"; f.Text = "NEW"; f.Size = new Size(100, 100); f.Controls.Add(b); f.TopLevel = false;
1
1684
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, Tab-toTab) in Tab Control on form?
8
3601
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 picture box, lots of text boxes (for input).. you get the idea. All of a sudden everything on the form has disappeared, it looks like a blank, newly created form. I can still get to the properties of every item on the form using the drop-down box in...
5
13311
by: Amit | last post by:
Can anyone write the code to hide tabpage of tab control in windows form 2.0 Thanks, Amit
12
2376
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 from the User Control in Form2 ? Hope this is clear enough...
6
12946
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 TabPage that wad made during the design time together with all its controls, but without the controls data. Is there an easy way to do that?
1
2016
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)); thread.IsBackground = true; thread.Start(); In Form2 I have: public delegate void mydata(String e);
0
9931
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9777
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11108
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7956
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7113
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5781
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3226
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.