Why is the control inaccessible due to its protection level?

user164203 picture user164203 · Nov 16, 2009 · Viewed 50.8k times · Source

I'm trying to access a control's text property from program.cs and it says that it is inaccessible due to protected level. How can I fix this please?

Answer

jay_t55 picture jay_t55 · Nov 16, 2009

This is the default property for controls and can be solved by:

  1. Going into Design-View for the Form that contains the specified Control
  2. Then changing the Control's Modifiers property to Public or Internal.

Control Properties > Modifiers Screenshot