Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I make a text box components Namely alphabet_TextBox when i put in form and change modifiers to public This error happens:
Error	1	Inconsistent accessibility: field type 'WindowsFormsApplication2.Alphabet_TextBox' is less accessible than field 'WindowsFormsApplication2.frmEdit.alphabet_TextBox2'

and here's code in form.designer:
public Alphabet_TextBox alphabet_TextBox2;

help plz.
Posted

1 solution

Don't do it!
Never make your components public - it causes the design of your form to be "locked" - you cannot change the way the form works, because you do not know what the outside world has done with your textbox.

Instead, use a public property:

C#
public AlphabetText
   {
   get { return alphabet_TextBox2.Text; }
   set { alphabet_TextBox2 = value; }
   }
You can then change the way your form works without the outside world being any the wiser, provided that your property returns the same values.
 
Share this answer
 
Comments
amirmohamad 16-Sep-12 3:49am    
tank's OriginalGriff for your advice and help
5+
OriginalGriff 16-Sep-12 4:03am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900