-
modifying members of form base class and reflecting on children
Hi,
I have a base windows form class and another windows form ('frmCustomers')
that inherits from this base form. I have this problem:
1) if I change the name of a command button in the base form formerly named
"button8" to "cmbExit" and then try to build the solution I get the error "
'button8' is not a member of 'ATC.frmCustomers' ". Just for information the
button is 'Modifiers' = Public. How can I change the name of the button and
have it reflect on the inheriting forms?
2) How can I delete an object on the base form and have it reflect on the
inheriting forms. I tried this before and it really messed up my inheriting
forms so now I don't DARE try this, what is the way to do it?
Thanks!
-
Re: modifying members of form base class and reflecting on children
My guess, withiout seeing ANY code, is that you have code, in frmCustomers,
that uses the original command button NAME, in the code. When you change
the NAME of a control in the base class, there is NO way to change the Code,
making use of that control, in the derived class.
You should get the design of the base class solidified, BEFORE you use it
as the base of an inheritance structure. This is sometimes refered to as
the Fragile Base Class Problem.
Arthur Wood
"rguti" <royguti@bellsouth.net> wrote:
>Hi,
>
>I have a base windows form class and another windows form ('frmCustomers')
>that inherits from this base form. I have this problem:
>
>1) if I change the name of a command button in the base form formerly named
>"button8" to "cmbExit" and then try to build the solution I get the error
"
>'button8' is not a member of 'ATC.frmCustomers' ". Just for information
the
>button is 'Modifiers' = Public. How can I change the name of the button
and
>have it reflect on the inheriting forms?
>
>2) How can I delete an object on the base form and have it reflect on the
>inheriting forms. I tried this before and it really messed up my inheriting
>forms so now I don't DARE try this, what is the way to do it?
>
>Thanks!
>
>
-
Re: modifying members of form base class and reflecting on children
Thanks for your response Arthur,
No, I don't have any code that references that command button. Actually I
have a few buttons, that I tried to do this for and same problem. It seems
the simplest of things that it should be able to handle, very strange. But I
did do a simple test with a form and just one button and it worked like you
said, something must be impeding this in my base form, thanks for the
suggestion, a new round of testing .
"Arthur Wood" <wooda@nospam.com> wrote in message
news:3dbc93b8$1@tnews.web.devx.com...
>
> My guess, withiout seeing ANY code, is that you have code, in
frmCustomers,
> that uses the original command button NAME, in the code. When you change
> the NAME of a control in the base class, there is NO way to change the
Code,
> making use of that control, in the derived class.
>
> You should get the design of the base class solidified, BEFORE you use it
> as the base of an inheritance structure. This is sometimes refered to as
> the Fragile Base Class Problem.
>
> Arthur Wood
>
>
> "rguti" <royguti@bellsouth.net> wrote:
> >Hi,
> >
> >I have a base windows form class and another windows form
('frmCustomers')
> >that inherits from this base form. I have this problem:
> >
> >1) if I change the name of a command button in the base form formerly
named
> >"button8" to "cmbExit" and then try to build the solution I get the error
> "
> >'button8' is not a member of 'ATC.frmCustomers' ". Just for information
> the
> >button is 'Modifiers' = Public. How can I change the name of the button
> and
> >have it reflect on the inheriting forms?
> >
> >2) How can I delete an object on the base form and have it reflect on the
> >inheriting forms. I tried this before and it really messed up my
inheriting
> >forms so now I don't DARE try this, what is the way to do it?
> >
> >Thanks!
> >
> >
>
-
Re: modifying members of form base class and reflecting on children
Did a simple test. Created a base form with a button. Created an inherited
form based on the base form and that was it.
Then I went ahead and changed the name of the button on the base form, did a
build and it reflected on the inherited form.
Then I went to the inherited form and changed the size and position of the
button. Went back to the base form and changed the name of the button again
but this time when Building the solution I got the "is not a member of"
error.
I went back to the inherited form and reset to default anything that was
changed, went back to the base form and changed the name again, I'm saying
to myself "This has to work, it's pain but I don't mind doing some extra
work with all my controls in the inhereting forms to reset them to defaults
and then change the name of the buttons in the base form and set their
properties back in the inheriting forms for the sake of finally changing the
names", but no!, it still doesn't do it!, how can it be so difficult to
change a $#$%$#% name. Sorry to complain, but need to vent hehe.
Any ideas? is this a bug?
"Arthur Wood" <wooda@nospam.com> wrote in message
news:3dbc93b8$1@tnews.web.devx.com...
>
> My guess, withiout seeing ANY code, is that you have code, in
frmCustomers,
> that uses the original command button NAME, in the code. When you change
> the NAME of a control in the base class, there is NO way to change the
Code,
> making use of that control, in the derived class.
>
> You should get the design of the base class solidified, BEFORE you use it
> as the base of an inheritance structure. This is sometimes refered to as
> the Fragile Base Class Problem.
>
> Arthur Wood
>
>
> "rguti" <royguti@bellsouth.net> wrote:
> >Hi,
> >
> >I have a base windows form class and another windows form
('frmCustomers')
> >that inherits from this base form. I have this problem:
> >
> >1) if I change the name of a command button in the base form formerly
named
> >"button8" to "cmbExit" and then try to build the solution I get the error
> "
> >'button8' is not a member of 'ATC.frmCustomers' ". Just for information
> the
> >button is 'Modifiers' = Public. How can I change the name of the button
> and
> >have it reflect on the inheriting forms?
> >
> >2) How can I delete an object on the base form and have it reflect on the
> >inheriting forms. I tried this before and it really messed up my
inheriting
> >forms so now I don't DARE try this, what is the way to do it?
> >
> >Thanks!
> >
> >
>
-
Re: modifying members of form base class and reflecting on children
Display all the code. AFAIK the visual designer add code to the inherited
form to set the properties of the button. If you change its name in the base
form, it no longer exists in the inherited form causing this problem
(updating the name in the inherited designer generated code should solve the
problem).
Of course the best way to workaround this problem is probably to have the
base form with the intended names before starting inheriting from this base
form....
Patrice
"rguti" <royguti@bellsouth.net> a écrit dans le message de news:
3dbcc516$1@tnews.web.devx.com...
> Did a simple test. Created a base form with a button. Created an inherited
> form based on the base form and that was it.
>
> Then I went ahead and changed the name of the button on the base form, did
a
> build and it reflected on the inherited form.
>
> Then I went to the inherited form and changed the size and position of the
> button. Went back to the base form and changed the name of the button
again
> but this time when Building the solution I got the "is not a member of"
> error.
>
> I went back to the inherited form and reset to default anything that was
> changed, went back to the base form and changed the name again, I'm saying
> to myself "This has to work, it's pain but I don't mind doing some extra
> work with all my controls in the inhereting forms to reset them to
defaults
> and then change the name of the buttons in the base form and set their
> properties back in the inheriting forms for the sake of finally changing
the
> names", but no!, it still doesn't do it!, how can it be so difficult to
> change a $#$%$#% name. Sorry to complain, but need to vent hehe.
>
> Any ideas? is this a bug?
>
>
>
>
> "Arthur Wood" <wooda@nospam.com> wrote in message
> news:3dbc93b8$1@tnews.web.devx.com...
> >
> > My guess, withiout seeing ANY code, is that you have code, in
> frmCustomers,
> > that uses the original command button NAME, in the code. When you
change
> > the NAME of a control in the base class, there is NO way to change the
> Code,
> > making use of that control, in the derived class.
> >
> > You should get the design of the base class solidified, BEFORE you use
it
> > as the base of an inheritance structure. This is sometimes refered to
as
> > the Fragile Base Class Problem.
> >
> > Arthur Wood
> >
> >
> > "rguti" <royguti@bellsouth.net> wrote:
> > >Hi,
> > >
> > >I have a base windows form class and another windows form
> ('frmCustomers')
> > >that inherits from this base form. I have this problem:
> > >
> > >1) if I change the name of a command button in the base form formerly
> named
> > >"button8" to "cmbExit" and then try to build the solution I get the
error
> > "
> > >'button8' is not a member of 'ATC.frmCustomers' ". Just for information
> > the
> > >button is 'Modifiers' = Public. How can I change the name of the
button
> > and
> > >have it reflect on the inheriting forms?
> > >
> > >2) How can I delete an object on the base form and have it reflect on
the
> > >inheriting forms. I tried this before and it really messed up my
> inheriting
> > >forms so now I don't DARE try this, what is the way to do it?
> > >
> > >Thanks!
> > >
> > >
> >
>
>
-
Re: modifying members of form base class and reflecting on children
Hi Patrice,
I'm not really sure what you're suggesting. It can't compile in the first
place b/c of this error, the curious thing is that when I'm looking at the
properties of the inheriting form, I see that the name of the button hasn't
changed but if I'm writing code on the load, the new name that it "should"
be inheriting shows up in the intellisense, sounds like a bug to me.
> Of course the best way to workaround this problem is probably to have the
> base form with the intended names before starting inheriting from this
base
> form....
In the perfect world, I'm trying to write a little framework, and I have to
change things like adjust, add, and delete objects. But I understand what
you're saying, we strive for that but the reality is different and software
tools usually account for that. I'm a Visual Foxpro programmer and we have
inheritance and I didn't run into this type of trivial problems. Now .NET is
more powerful and complex but it seems to me that since there's so much
complexity to this product, it's still somewhat unstable, seems like they
rushed the product and didn't adjust and tweak some things that needed it. I
feel like I'm walking on eggshells doing this inheritance, already have 2
forms crap out and I backup my project every 2 hours just in case.
Thanks for your help.
"Patrice Scribe" <scribe@chez.com> wrote in message
news:3dbd2f57$1@tnews.web.devx.com...
> Display all the code. AFAIK the visual designer add code to the inherited
> form to set the properties of the button. If you change its name in the
base
> form, it no longer exists in the inherited form causing this problem
> (updating the name in the inherited designer generated code should solve
the
> problem).
>
> Of course the best way to workaround this problem is probably to have the
> base form with the intended names before starting inheriting from this
base
> form....
>
> Patrice
>
> "rguti" <royguti@bellsouth.net> a écrit dans le message de news:
> 3dbcc516$1@tnews.web.devx.com...
> > Did a simple test. Created a base form with a button. Created an
inherited
> > form based on the base form and that was it.
> >
> > Then I went ahead and changed the name of the button on the base form,
did
> a
> > build and it reflected on the inherited form.
> >
> > Then I went to the inherited form and changed the size and position of
the
> > button. Went back to the base form and changed the name of the button
> again
> > but this time when Building the solution I got the "is not a member of"
> > error.
> >
> > I went back to the inherited form and reset to default anything that was
> > changed, went back to the base form and changed the name again, I'm
saying
> > to myself "This has to work, it's pain but I don't mind doing some extra
> > work with all my controls in the inhereting forms to reset them to
> defaults
> > and then change the name of the buttons in the base form and set their
> > properties back in the inheriting forms for the sake of finally changing
> the
> > names", but no!, it still doesn't do it!, how can it be so difficult to
> > change a $#$%$#% name. Sorry to complain, but need to vent hehe.
> >
> > Any ideas? is this a bug?
> >
> >
> >
> >
> > "Arthur Wood" <wooda@nospam.com> wrote in message
> > news:3dbc93b8$1@tnews.web.devx.com...
> > >
> > > My guess, withiout seeing ANY code, is that you have code, in
> > frmCustomers,
> > > that uses the original command button NAME, in the code. When you
> change
> > > the NAME of a control in the base class, there is NO way to change the
> > Code,
> > > making use of that control, in the derived class.
> > >
> > > You should get the design of the base class solidified, BEFORE you use
> it
> > > as the base of an inheritance structure. This is sometimes refered to
> as
> > > the Fragile Base Class Problem.
> > >
> > > Arthur Wood
> > >
> > >
> > > "rguti" <royguti@bellsouth.net> wrote:
> > > >Hi,
> > > >
> > > >I have a base windows form class and another windows form
> > ('frmCustomers')
> > > >that inherits from this base form. I have this problem:
> > > >
> > > >1) if I change the name of a command button in the base form formerly
> > named
> > > >"button8" to "cmbExit" and then try to build the solution I get the
> error
> > > "
> > > >'button8' is not a member of 'ATC.frmCustomers' ". Just for
information
> > > the
> > > >button is 'Modifiers' = Public. How can I change the name of the
> button
> > > and
> > > >have it reflect on the inheriting forms?
> > > >
> > > >2) How can I delete an object on the base form and have it reflect on
> the
> > > >inheriting forms. I tried this before and it really messed up my
> > inheriting
> > > >forms so now I don't DARE try this, what is the way to do it?
> > > >
> > > >Thanks!
> > > >
> > > >
> > >
> >
> >
>
>
-
Re: modifying members of form base class and reflecting on children
I meant that when you change the button name in the base form, the button
name is kept unchanged in the inherited form (and it won't compile anymore)
.. Note that changing something is enough for the desinger to create code (ie
you could have this problem even if you don't write the code yourself).
You should be able to update the name in the generated code so that it
compiles again...
Patrice
"rguti" <royguti@bellsouth.net> a écrit dans le message de news:
3dbd614c$1@tnews.web.devx.com...
> Hi Patrice,
>
> I'm not really sure what you're suggesting. It can't compile in the first
> place b/c of this error, the curious thing is that when I'm looking at the
> properties of the inheriting form, I see that the name of the button
hasn't
> changed but if I'm writing code on the load, the new name that it "should"
> be inheriting shows up in the intellisense, sounds like a bug to me.
>
> > Of course the best way to workaround this problem is probably to have
the
> > base form with the intended names before starting inheriting from this
> base
> > form....
> In the perfect world, I'm trying to write a little framework, and I have
to
> change things like adjust, add, and delete objects. But I understand what
> you're saying, we strive for that but the reality is different and
software
> tools usually account for that. I'm a Visual Foxpro programmer and we have
> inheritance and I didn't run into this type of trivial problems. Now .NET
is
> more powerful and complex but it seems to me that since there's so much
> complexity to this product, it's still somewhat unstable, seems like they
> rushed the product and didn't adjust and tweak some things that needed it.
I
> feel like I'm walking on eggshells doing this inheritance, already have 2
> forms crap out and I backup my project every 2 hours just in case.
>
> Thanks for your help.
>
>
> "Patrice Scribe" <scribe@chez.com> wrote in message
> news:3dbd2f57$1@tnews.web.devx.com...
> > Display all the code. AFAIK the visual designer add code to the
inherited
> > form to set the properties of the button. If you change its name in the
> base
> > form, it no longer exists in the inherited form causing this problem
> > (updating the name in the inherited designer generated code should solve
> the
> > problem).
> >
> > Of course the best way to workaround this problem is probably to have
the
> > base form with the intended names before starting inheriting from this
> base
> > form....
> >
> > Patrice
> >
> > "rguti" <royguti@bellsouth.net> a écrit dans le message de news:
> > 3dbcc516$1@tnews.web.devx.com...
> > > Did a simple test. Created a base form with a button. Created an
> inherited
> > > form based on the base form and that was it.
> > >
> > > Then I went ahead and changed the name of the button on the base form,
> did
> > a
> > > build and it reflected on the inherited form.
> > >
> > > Then I went to the inherited form and changed the size and position of
> the
> > > button. Went back to the base form and changed the name of the button
> > again
> > > but this time when Building the solution I got the "is not a member
of"
> > > error.
> > >
> > > I went back to the inherited form and reset to default anything that
was
> > > changed, went back to the base form and changed the name again, I'm
> saying
> > > to myself "This has to work, it's pain but I don't mind doing some
extra
> > > work with all my controls in the inhereting forms to reset them to
> > defaults
> > > and then change the name of the buttons in the base form and set their
> > > properties back in the inheriting forms for the sake of finally
changing
> > the
> > > names", but no!, it still doesn't do it!, how can it be so difficult
to
> > > change a $#$%$#% name. Sorry to complain, but need to vent hehe.
> > >
> > > Any ideas? is this a bug?
> > >
> > >
> > >
> > >
> > > "Arthur Wood" <wooda@nospam.com> wrote in message
> > > news:3dbc93b8$1@tnews.web.devx.com...
> > > >
> > > > My guess, withiout seeing ANY code, is that you have code, in
> > > frmCustomers,
> > > > that uses the original command button NAME, in the code. When you
> > change
> > > > the NAME of a control in the base class, there is NO way to change
the
> > > Code,
> > > > making use of that control, in the derived class.
> > > >
> > > > You should get the design of the base class solidified, BEFORE you
use
> > it
> > > > as the base of an inheritance structure. This is sometimes refered
to
> > as
> > > > the Fragile Base Class Problem.
> > > >
> > > > Arthur Wood
> > > >
> > > >
> > > > "rguti" <royguti@bellsouth.net> wrote:
> > > > >Hi,
> > > > >
> > > > >I have a base windows form class and another windows form
> > > ('frmCustomers')
> > > > >that inherits from this base form. I have this problem:
> > > > >
> > > > >1) if I change the name of a command button in the base form
formerly
> > > named
> > > > >"button8" to "cmbExit" and then try to build the solution I get the
> > error
> > > > "
> > > > >'button8' is not a member of 'ATC.frmCustomers' ". Just for
> information
> > > > the
> > > > >button is 'Modifiers' = Public. How can I change the name of the
> > button
> > > > and
> > > > >have it reflect on the inheriting forms?
> > > > >
> > > > >2) How can I delete an object on the base form and have it reflect
on
> > the
> > > > >inheriting forms. I tried this before and it really messed up my
> > > inheriting
> > > > >forms so now I don't DARE try this, what is the way to do it?
> > > > >
> > > > >Thanks!
> > > > >
> > > > >
> > > >
> > >
> > >
> >
> >
>
>
-
Re: modifying members of form base class and reflecting on children
Got it, Thanks Patrice!
"Patrice Scribe" <scribe@chez.com> wrote in message
news:3dbd6bd1$1@tnews.web.devx.com...
> I meant that when you change the button name in the base form, the button
> name is kept unchanged in the inherited form (and it won't compile
anymore)
> . Note that changing something is enough for the desinger to create code
(ie
> you could have this problem even if you don't write the code yourself).
>
> You should be able to update the name in the generated code so that it
> compiles again...
>
> Patrice
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks