When I develop a Windows Forms app in Visual Studio using C#, every control that I add to my form is by default marked as private
, which is what I want.
When using VB.NET, every control is by default marked as Friend
(the equivalent of internal
in C#), which is not what I want.
Can I just change this default? It seems like surely it's a setting somewhere.
VB.Net programmers have made extensive use of forms to build user interfaces. Each time you create a Windows application, Visual Studio will display a default blank form, onto which you can drag and drop controls from the Visual Studio Toolbox window.
The easiest way to design a form is to use the Windows Forms Designer in Visual Studio . NET.
Windows Forms Designer in Visual Studio provides a rapid development solution for creating Windows Forms-based applications. Windows Forms Designer lets you easily add controls to a form, arrange them, and write code for their events.
Annoying, isn't it.
What I usually do is when the form is stable, I replace Friend WithEvents
to Private
then add WithEvents
to the controls that have Handles
clauses.
Yes, you would think there was a setting, but I never found it.
This was suggested to Microsoft, but they chose not to fix it.
[Sorry, posting this as an answer because I don't have enough points to add comments.]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With