'inaccessible due to its protection level' Error

L

Larry

I have a VB background and am developing a new windows app in Csharp.
I'm getting the error.

'inaccessible due to its protection level'

I've added a TextBox1 and a Button1 to a form.

I double click the Button1 button.

inside the method I type

string strName;
strName = TextBox1.text;


when I go into debug mode I get the error.
'inaccessible due to its protection level'

and TextBox1.text is highlighted.
 
C

Carlos J. Quintero [.NET MVP]

On the contrary to VB.NET, C# is case sensitive, so change ".text" to
".Text". Otherwise the C# compiler thinks that you are trying to access a
protected member variable of the Control class which happens to have the
"text" name.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top