Is there a delcaration between Private and Friend

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a delcaration between Private and Friend

In one form I declared

private iParentID0 as integer

I couldn't access it from another form.

If I changed it to

friend iParentID0 as integer

Of course I could. However I'd like to expose this integer to only certain
other classes - in this case forms. Is there any easy way of doing this?

Another question is whether it's worth bothering implementing a workaround (
if one of you have one ) when vs 2005 might include an intermediate
declaration, or an easier workaround. Does anybody know if it does?

Dennis
 
Dennis said:
Is there a delcaration between Private and Friend

In one form I declared

private iParentID0 as integer

I couldn't access it from another form.

If I changed it to

friend iParentID0 as integer

Of course I could. However I'd like to expose this integer to only certain
other classes - in this case forms. Is there any easy way of doing this?

Not in .NET 1.1, no. There was some talk about the possibility that
..NET 2.0 might include such an ability, but it's not clear yet whether
it'll end up being in the final release. (I haven't checked to see if
it's in the beta or not.)
 
As said in the above reply there is no such way - as far
as I know of.
But, I can suggest a way that I think should be good
enough: inherit the Windows.Forms.Form class - this will
create a form class of your own - lets say you call it:
SpecialForm.
Now, anything you want to have access to - declare as
protected - this way only your SpecialForm classes can
access each others protected data members.
True, at first you might think this solution can't be
right but it works!

Haim.
 
Back
Top