473,788 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form inheritence

Can someone tell me how to create a form inherit from another form ?
In my project, I have created a form with buttons and groupbox to be used as
ancestor, how to create a form inherit from this form ?
Nov 6 '06 #1
7 1796
In my project, I have created a form with buttons and groupbox to be used
as ancestor, how to create a form inherit from this form ?
Change the code in the form class

public class MyForm : MyBaseForm
Nov 6 '06 #2
Alan T wrote:
Can someone tell me how to create a form inherit from another form ?
In my project, I have created a form with buttons and groupbox to be used as
ancestor, how to create a form inherit from this form ?
You can also do it by choosing Inherited Form as the new item type.
For example:

Right click on the project.
Choose Add -Windows Form
Choose Inherited Form

You should then be presented with a list of forms in the project to
choose from.

Nov 6 '06 #3
Hi,

Yes now I can create a inherited form.
However, it seems does not allow me to move the controls in my inherited
form.
I got a groupbox and would like to add another text box inside this groupbox
but it does allow me to.

"Will" <bk******@hotma il.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
Alan T wrote:
>Can someone tell me how to create a form inherit from another form ?
In my project, I have created a form with buttons and groupbox to be used
as
ancestor, how to create a form inherit from this form ?

You can also do it by choosing Inherited Form as the new item type.
For example:

Right click on the project.
Choose Add -Windows Form
Choose Inherited Form

You should then be presented with a list of forms in the project to
choose from.

Nov 7 '06 #4

Alan T wrote:
Hi,

Yes now I can create a inherited form.
However, it seems does not allow me to move the controls in my inherited
form.
I got a groupbox and would like to add another text box inside this groupbox
but it does allow me to.
You need to change the Protection setting of the controls on the base
form from Private (the default) to at least Protected so that they are
changeable by inheriting forms.

Nov 7 '06 #5
Thanks Bruce.
I just what would happen if I have up to hundred controls in my ancestor
form and need to change it to Proteced manually.
Is that any shortcut to change the controls from private to proteced ?

"Bruce Wood" <br*******@cana da.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
>
Alan T wrote:
>Hi,

Yes now I can create a inherited form.
However, it seems does not allow me to move the controls in my inherited
form.
I got a groupbox and would like to add another text box inside this
groupbox
but it does allow me to.

You need to change the Protection setting of the controls on the base
form from Private (the default) to at least Protected so that they are
changeable by inheriting forms.

Nov 7 '06 #6
You can edit the definitions that Visual Studio Designer inserts into
your .cs file. Or, if you're using .NET 2.0, you'll have to find the
other half of your Form's partial class, the half written by Visual
Studio. If you close the Designer, change things from private to
protected in code and then restart the Designer, all should be well.

Within the Designer itself... well, it's select, change, select,
change, ....

Alan T wrote:
Thanks Bruce.
I just what would happen if I have up to hundred controls in my ancestor
form and need to change it to Proteced manually.
Is that any shortcut to change the controls from private to proteced ?

"Bruce Wood" <br*******@cana da.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .

Alan T wrote:
Hi,

Yes now I can create a inherited form.
However, it seems does not allow me to move the controls in my inherited
form.
I got a groupbox and would like to add another text box inside this
groupbox
but it does allow me to.
You need to change the Protection setting of the controls on the base
form from Private (the default) to at least Protected so that they are
changeable by inheriting forms.
Nov 7 '06 #7
Hi,

Now I have a problem in creating an inherited form.
I created a Class Library and a base form in it, then want to add a new form
inherited from that base form.
VS 2005 ask me about the base form but only limited to a dll. If I choose to
inherit from the base form then it cannot let me thro the process, only
select a dll.

"Bruce Wood" <br*******@cana da.comwrote in message
news:11******** *************@i 42g2000cwa.goog legroups.com...
You can edit the definitions that Visual Studio Designer inserts into
your .cs file. Or, if you're using .NET 2.0, you'll have to find the
other half of your Form's partial class, the half written by Visual
Studio. If you close the Designer, change things from private to
protected in code and then restart the Designer, all should be well.

Within the Designer itself... well, it's select, change, select,
change, ....

Alan T wrote:
>Thanks Bruce.
I just what would happen if I have up to hundred controls in my ancestor
form and need to change it to Proteced manually.
Is that any shortcut to change the controls from private to proteced ?

"Bruce Wood" <br*******@cana da.comwrote in message
news:11******* *************** @b28g2000cwb.go oglegroups.com. ..
>
Alan T wrote:
Hi,

Yes now I can create a inherited form.
However, it seems does not allow me to move the controls in my
inherited
form.
I got a groupbox and would like to add another text box inside this
groupbox
but it does allow me to.

You need to change the Protection setting of the controls on the base
form from Private (the default) to at least Protected so that they are
changeable by inheriting forms.

Nov 10 '06 #8

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

Similar topics

1
4144
by: John | last post by:
Hi, I am trying to create a class heirarchy similar to the following: // base interface class ICar { public: virtual void start() = 0; }; // add members to that interface, but retain base capabilities
0
1376
by: Jan Elbæk | last post by:
Hi, I would like to make a base form in my project - which (almost) all forms must inherit from. The baseform must have some visible elements (a toolbar, a topaligned panel and a picturebox and perhaps some more). Also. I need it to have a specielized constructor in the base. And the baseform must implement some methods (like Setstatusbartext) - and som default eventhandlers (like Closing), which must be virtual so that additional code can...
7
1985
by: preetam | last post by:
Hi, This question is more towards design than towards c++ details. By looking at books on design patterns and various google threads on the same topic, I see that composition is favoured to inheritence. One more article I read was Allen holub's "Why extends is evil". http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html One general advice I found was that - extending behaviour is better done with interfaces and...
3
2072
by: Wojciech Trelak | last post by:
Hi, Does anyone know how to change an owner of a control inherited from the base form? In code it's simple, but the real question is how to force designer to do this? Is it possible? I tried to play with the Component Designer Generated Code Best Regards
0
885
by: David | last post by:
hay there again, i am having trouble with the visual studio environment. what i am tring to do is inherit from a base form which is just a simple title bar and i want to use this for all other forms via inheritance. anyway, when i follow the walkthrough it tells me to right click on the project in server explorer and then click on add and then inherited form. the problem is that there is no listing of the inherited form button... so i...
1
1293
by: 234 | last post by:
I'm playing around with page inheritence and I'm to the point now where I want to create a form object on a derived page. Here's a truncated version of my 'base' page from which all/most pages in the application would be derived: ------------------------- Public Class clsBasePage Inherits System.Web.UI.Page Private objForm as new HtmlForm Public Event ReadyforPageContent()
5
2127
by: Neelesh Bodas | last post by:
This might be slightly off-topic. Many books on C++ consider multiple inheritence as an "advanced" concept. Bruce Eckel says in TICPP, volume 2 that "there was (and still is) a lot of disagreement about whether is essential in C++". Are there any disadvantages of using multiple inheritence?
2
3229
by: Zull | last post by:
I've got a base form wich is a parent form for few others. On this base form I have dataGridView control, which has Modifiers property set on 'Protected Internal'. Unfortuantely, it does not work as I expected... :( I wanted to link Data Set on every inherited form with inherited dataGridView.... dGV control is greyed, and all settings are unaccesible :( This shema works perfectly for Buttons, CheckBoxes and others, but I can't
4
1948
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on parent form and this button is visible to me on inherited form. The problem is: I have written a click event of the button1 on both of the forms. tell me the way if i click the button on inherited form only parents' click event will be called and...
5
2038
by: Gun Slinger | last post by:
Hi i just have a quick question. I ran a search but i was not sure really how to word it correctly and couldnt find anything. I would like to know how I can create a form object like a textbox, label or combo box from the one variable? Obviously for a label it is easy by itself, i have just been doing.. public System.Windows.Forms.Label obj_field_control = new System.Windows.Forms.Label;
0
9656
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
9498
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
10366
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...
0
10173
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
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
5399
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...
3
2894
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.