473,569 Members | 3,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inherited Form

Hi.

I couldn't find it in msdn. I have a form AddCategory. Now I need
EditCategory form which should look exactlay like AddCategory. I add an
inherited form to the project. Now all controls' properties are read-only. I
need to change AddButton's Name and Text properties to Edit. I change
Modifier property of the parent control to public, but it doesn't solve.

Can anybody help me?
Thanks.
Emil.
May 11 '07 #1
4 3492
I changed modifier of InitializeCompo nents method of parent form, it worked,
but the name property still remains read-only. Is there any way to 'unlock'
all properties of the inherited form?

"EmilH" <em*****@yahoo. comwrote in message
news:ua******** ******@TK2MSFTN GP03.phx.gbl...
Hi.

I couldn't find it in msdn. I have a form AddCategory. Now I need
EditCategory form which should look exactlay like AddCategory. I add an
inherited form to the project. Now all controls' properties are read-only.
I need to change AddButton's Name and Text properties to Edit. I change
Modifier property of the parent control to public, but it doesn't solve.

Can anybody help me?
Thanks.
Emil.

May 11 '07 #2
On May 10, 10:06 pm, "EmilH" <emil...@yahoo. comwrote:
Hi.

I couldn't find it in msdn. I have a form AddCategory. Now I need
EditCategory form which should look exactlay like AddCategory. I add an
inherited form to the project. Now all controls' properties are read-only. I
need to change AddButton's Name and Text properties to Edit. I change
Modifier property of the parent control to public, but it doesn't solve.
Whilst editing the AddCategory form in the Windows Forms Designer, you
need to change the AddButton's protection from "private" to
"protected" . Then you will be able to modify its properties from the
Designer.

By the way, I don't think that you want to modify the button's Name
property... that's what it's called in the code. The Text is what
shows on the button.

May 11 '07 #3
Thanks for reply, Bruce.
I'll try to explain more exactly what I need.

AddCategory EditCategory

They both contain button addBut. 2nd is inherited from the first. I want to
be able to change addBut.Name and addBut.text properties of the second form
(EditCategory) in the designer. Butchanging modifier to protected didn't
solve the problem. I changed it to public (the most accessible modifier)
before. I'm not even able to delete any control on the inherited form.

Is there anything to do with a 'new' keyword?

Emil.
"Bruce Wood" <br*******@cana da.comwrote in message
news:11******** **************@ u30g2000hsc.goo glegroups.com.. .
On May 10, 10:06 pm, "EmilH" <emil...@yahoo. comwrote:
>Hi.

I couldn't find it in msdn. I have a form AddCategory. Now I need
EditCategory form which should look exactlay like AddCategory. I add an
inherited form to the project. Now all controls' properties are
read-only. I
need to change AddButton's Name and Text properties to Edit. I change
Modifier property of the parent control to public, but it doesn't solve.

Whilst editing the AddCategory form in the Windows Forms Designer, you
need to change the AddButton's protection from "private" to
"protected" . Then you will be able to modify its properties from the
Designer.

By the way, I don't think that you want to modify the button's Name
property... that's what it's called in the code. The Text is what
shows on the button.

May 11 '07 #4
On Thu, 10 May 2007 23:22:30 -0700, EmilH <em*****@yahoo. comwrote:
[...]
They both contain button addBut. 2nd is inherited from the first. I want
to
be able to change addBut.Name and addBut.text properties of the second
form
(EditCategory) in the designer. Butchanging modifier to protected didn't
solve the problem. I changed it to public (the most accessible modifier)
before. I'm not even able to delete any control on the inherited form.
Did you change the access modifier for the button field itself? Or did
you change the access modifier for the InitializeCompo nent() method? Your
previous post indicates you did the latter, but it's the former that you
need to do. Changing the modifier from "private" to "protected" should be
sufficient.

As for deleting controls, I don't see any reason that you should expect to
be able to do that. The control is in the base form, not the derived
form. If you could delete the control from the derived form, that would
require removing it from the base form as well, which of course would
screw up that form as well as any other form that inherits it.

Likewise changing the "Name" property of the button. Since the "Name" is
actually used for the name of the field in the base form, you cannot
change it in the derived form, and for the same reasons that you can't
delete the control altogether.

If you don't want a base form control to show, you'll have to add run-time
code to either hide or remove it from the form instance. You do not have
any option for changing the name in the designer, other than changing it
in the base form. However, as with deleting the control, you should be
able to have the Name property of the control in your run-time code (but
at that point, it won't change the in-code name of the field for the
control...just the "Name" property itself).

Pete
May 11 '07 #5

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

Similar topics

2
2200
by: Jeff Levinson [mcsd] | last post by:
I guess I would have to know what you mean by "not being able to edit the forms". Does this mean you get an error in the designer when you try to display an inherited form? Does this mean the controls are visible, but you can't move them around? What exactly does it mean? There are a variety of methods for editing visuallly inherited forms...
1
1560
by: RRiness | last post by:
I'm trying to use a template form I created. When I add an inherited form to my project, I get the error: Object reference not set to an instance of an object. when the inherited form is displayed in the designer. Last week I used the same template and didn't have any trouble creating inherited forms. I can look at the new form in code...
13
2214
by: Lorne Smith | last post by:
Hi, First, sorry for the crosspost, but it seemed appropriate... :) I've come accross what I consider to be a bug, but I don't know if it's already known or not. (VS .Net 2003 Pro - VB.Net) Whilst playing with inherited forms, I created a simple base form containing a single button. I set this buttons' Click event to be public...
8
6679
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and contains a few controls anchored to the sides of the form. "frmChild" inherits from "frmBase"... and the controls appear on the inherited form as...
4
2646
by: JC Voon | last post by:
Hi: My base form has a button, when click it will call MessageBox.Show( "Base form" ). I inherite a child form from the base and assign a button click event to the same button which will call MessageBox.Show( "Inherited form" ). I run my application, and load the clild form, click the button it show both message !!! Is there any way to...
2
1749
by: Steve Teeples | last post by:
I have a simple form with a panel that is docked in the base form. The panel has three controls - two buttons and one treeview. I use "Inherited Form" when creating a second form derived from this parent form. The only thing is there are no controls in the inherited form. I made all the base controls "protected". What am I dong wrong? ...
4
1938
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....
4
16242
by: Mikus Sleiners | last post by:
I can't seem to add new controls to form that is inherited from another form. I have BaseForm wich have table layout on it 2 panelsm and some buttons. Now i create InheritedForm : BaseForm and want to add some new controls and add them to pannels but i can't drag and drop them ... designer does not allow me. Why is that ? Panels and...
0
1207
by: SM | last post by:
Hi, #1 I did some changes in my inherited form (change some properties of my components), now I want to rollback all changes made in inherited form and return to the same state as the base form, I used to use Delphi and this powerful and stable environment include nice functionally we just right
0
1450
by: Paul W | last post by:
Hello everyone, My problem is with an inherited Form. The base Form has a few controls on it that are anchored such that they move as the Form is resized. While in the designer, the inherited Form works perfectly but when I run the program the controls on the inherited Form are positioned based on the size of the base Form instead of the...
0
7703
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...
1
7681
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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...
0
6290
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...
1
5514
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...
0
5228
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...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
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...

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.