Why is the modifier set to Friend in Winforms?
Asked Answered
M

2

4

When adding a new control to the designer in Winforms, the modifier on the control is set to Friend, but the default modifier is Private (right clicking the property and resetting the modifier).

Does anyone know why?

Is there a setting to set the modifier to default (Private)?

Mongeau answered 14/9, 2010 at 8:3 Comment(0)
B
3

This is just the default which was chosen by the VB.Net IDE team. While I don't know the reason behind the decision my guess is that it was to maintain a compatible design experience with VB6.

There is no way that I know of to override this value

Binoculars answered 14/9, 2010 at 9:9 Comment(2)
+1 Can we please have a way to override the value? Is it possible with an add-in, do you know?Yerkovich
@MarkJ, I think the best approach to getting this changed is to file an issue on connect (I don't work on that team anymore). connect.microsoft.comBinoculars
A
3

Are you sure it's showing as friend? I tried to reproduce the same here but it's always showing as private. Am using Visual Studio 2008.

After lot of googling, I eventually found some answers and they are right here on SO:

VB.NET: what does the 'friend' modifier do?

Set a project default for VB.NET projects so that the default Modifiers property for controls is Private

Abfarad answered 14/9, 2010 at 8:17 Comment(2)
Yes. I am sure. Tried it in VS 2010. Maybe there is a setting to control this? Thanks for trying.Mongeau
+1 In fact this question is almost a duplicate of the can I set something so the default modifier is private questionYerkovich
B
3

This is just the default which was chosen by the VB.Net IDE team. While I don't know the reason behind the decision my guess is that it was to maintain a compatible design experience with VB6.

There is no way that I know of to override this value

Binoculars answered 14/9, 2010 at 9:9 Comment(2)
+1 Can we please have a way to override the value? Is it possible with an add-in, do you know?Yerkovich
@MarkJ, I think the best approach to getting this changed is to file an issue on connect (I don't work on that team anymore). connect.microsoft.comBinoculars

© 2022 - 2024 — McMap. All rights reserved.