(Problem Solved) Control Inaccessible Due To Its Protection Level In C-Sharp – [How To Fix] (Visual Studio 2010 )

(Problem Solved) Control Inaccessible Due To Its Protection Level In C# – [How To Fix] (Visual Studio 2010 )

Control Inaccessible Due To Its Protection Level In C#

This Tutorial Shows How To Solve “Control Inaccessible Due To Its Protection Level” C# Error in Visual Studio 2010.

I get this error when trying to access Textbox from another form. So to fix this error

Step 1. Select The Item You Want To Make Accessible By Clicking On It.

Control Inaccessible Due To Its Protection Level In C-Sharp
Control Inaccessible Due To Its Protection Level In C-Sharp


Step 2. Right Click On It And Select Properties.

Control Inaccessible Due To Its Protection Level In C#
Control Inaccessible Due To Its Protection Level In C#


Step 3. Change Modifier Value From Private To Public.

Control Inaccessible Due To Its Protection Level
Control Inaccessible Due To Its Protection Level

Then You Can access it from another form as shown in the source code below:

 ViewSelectedDatagridviewRow showNewFormOnButtonClick = new ViewSelectedDatagridviewRow();
showNewFormOnButtonClick.txtBoxFirstName.Text = "";

Leave a Reply

Your email address will not be published. Required fields are marked *