Help me with this error message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

when i am writing a program in c# using windows app I am getting this error
message as System.Windows.Forms.Control.Text is inaccessable due to its
protection level.

In the design window when i am placing some controls like textbox,label and
button.---my code the code displayed is as follows

public class form1:system.windows.forms.form
{
private system.windows.forms.button button1;
private system.windows.forms.button button2;

Why is it taking private automatically??

Help me out
 
when i am writing a program in c# using windows app I am getting this
error
message as System.Windows.Forms.Control.Text is inaccessable due to its
protection level.

System.Windows.Forms.Control.text is inaccessible, System.Windows.Forms.Text
is a public property, so it's definitely accessible.
Why is it taking private automatically??
Because private is the implicit access modifier set in form designer.
You can change implicit access modifiers given to controls on your designed
form in the property grid when designing the form.
 
amita,

Control.Text property is accessible because it is public. Can you post the
exact error text.
 

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

Back
Top