Connecting Tech Pros Worldwide Forums | Help | Site Map

Help me with this error message

amita
Guest
 
Posts: n/a
#1: May 2 '06
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


Lebesgue
Guest
 
Posts: n/a
#2: May 2 '06

re: Help me with this error message


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

System.Windows.Forms.Control.text is inaccessible, System.Windows.Forms.Text
is a public property, so it's definitely accessible.
[color=blue]
> Why is it taking private automatically??[/color]
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" <amita@discussions.microsoft.com> wrote in message
news:B170AA04-3F30-4586-B38D-F6E0966AE2E9@microsoft.com...[color=blue]
> 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
>[/color]


Stoitcho Goutsev \(100\)
Guest
 
Posts: n/a
#3: May 3 '06

re: Help me with this error message


amita,

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


--
Stoitcho Goutsev (100)

"amita" <amita@discussions.microsoft.com> wrote in message
news:B170AA04-3F30-4586-B38D-F6E0966AE2E9@microsoft.com...[color=blue]
> 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
>[/color]


Closed Thread