Friend modifier and derived forms

  • Thread starter Thread starter Chris Leffer
  • Start date Start date
C

Chris Leffer

Hi.

The documentation says that variables declared Friend can be used
anywhere on the same program. I have a VB form that is the base form for
other forms on the same application. Controls that have the Modifiers
property set to Friend on the base form can not be modified on the
derived forms. Why?
Shouldn't Friend controls be acessed anywhere on the same program?

Regards,
Chirs Leffer
 
Hi Chris,

The same is true with C#' internal keyword.
Don't know why, though - it should work without problems.
The funny thing is, that if you add protected infront of internal/friend it
works - it is more restricted then without protected.
 
Miha Markic said:
The funny thing is, that if you add protected infront of internal/friend it
works - it is more restricted then without protected.

Not true - Internal means "Anywhere in the current assembly", and protected
means "in this class or any derived class". Using both internal and
protected on the same variable applies the complete range of both scopes to
the variable, so you can access it from anywhere you could with either
internal or protected.

Jason Dorie
 
Hi Jason,

Ooops, yes, my mistake - typed too fast :)
But still it is not a valid reason for forms inheritance designer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top