-2

I would like to make the controls inside my user control private, so that only the methods/properties I choose to expose are accessible.

I found this similar question: How do I make my controls inside a UserControl private?

However, I would like to know how/if this can be done in windows forms (not wpf.)

It seems like something that should be really simple... what am I missing?

Thanks.

EDIT: In response to some of the comments/answers, I just want to make it clear that I am using VB.net for which the default modifier for a control is "friend", not "Private".

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Gravitate
  • 2,885
  • 2
  • 21
  • 37

2 Answers2

1

Change the modifier of the control to private notice that this is private by default in winforms c# but in vb win forms this will be set to friend by default.

enter image description here

Timon Post
  • 2,779
  • 1
  • 17
  • 32
0

I would recommend changing the Modifiers, as per https://msdn.microsoft.com/en-us/library/ms233630(v=vs.110).aspx .

mjwills
  • 23,389
  • 6
  • 40
  • 63