c# - Inconsistent accessibility: parameter is less accessible than method *LINE 35* -


inconsistent accessibility: parameter less accessible method line 35 cant figure out life of me whats wrong, have feeling private when should public, cant find it.

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.net;  namespace hangman {     public partial class hangman : form     {         public hangman()         {             initializecomponent();         }          private string word = string.empty;         list<label> labels = new list<label>();         private int amount;          enum bodyparts         {             head,             body,             right_arm,             left_arm,             right_leg,             left_leg         }          void drawbodypart(bodyparts bp)         {             graphics g = manpanel.creategraphics();             pen p = new pen(color.blue, 2);              if(bp == bodyparts.head)             {                 g.drawellipse(p, 40, 50, 40, 40);             }             else if (bp == bodyparts.body)             {                 g.drawline(p, new point(60, 90), new point(60, 170));             }             else if (bp == bodyparts.right_arm)             {                 g.drawline(p, new point(60, 100), new point(90, 85));             }             else if (bp == bodyparts.left_arm)             {                 g.drawline(p, new point(60, 100), new point(30, 85));             }             else if (bp == bodyparts.right_leg)             {                 g.drawline(p, new point(60, 170), new point(90, 190));             }             else if (bp == bodyparts.left_leg)             {                 g.drawline(p, new point(60, 170), new point(30, 190));             }         }          void drawhangpost()         {             graphics g = manpanel.creategraphics();             pen p = new pen(color.brown, 10);              g.drawline(p, new point(130, 218), new point(130, 5));             g.drawline(p, new point(135, 5), new point(65, 5));             g.drawline(p, new point(60, 0), new point(60, 50));         }          void makelabels()         {             word = getrandomword();             char[] chars = word.tochararray();             int between = 330 / chars.length - 1;              (int = 0; < chars.length - 1; i++ )             {                 labels.add(new label());                 labels[i].location = new point((i * between) + 10, 80);                 labels[i].text = "_";                 labels[i].parent = labelsgroupbox;                 labels[i].bringtofront();                 labels[i].createcontrol();             }              label1.text += (chars.length - 1).tostring();         }          string getrandomword()         {             webclient wc = new webclient();             string wordlist = wc.downloadstring("http://www-01.sil.org/linguistics/wordlists/english/wordlist/wordsen.txt");             string[] words = wordlist.split('\n');             random rand = new random();             return words[rand.next(0, words.length - 1)];         }          void resetgame()         {             graphics g = manpanel.creategraphics();             g.clear(manpanel.backcolor);             getrandomword();             makelabels();             drawhangpost();             missedlabel.text = "";             guesseslabel.text = "";         }          private void form1_load(object sender, eventargs e)         {             drawhangpost();             makelabels();              button[] buttons = new button[] { buttona, buttonb, buttonc, buttond, buttone, buttonf,              buttong, buttonh, buttoni, buttonj, buttonk, buttonl, buttonm, buttonn, buttono, buttonp,              buttonq, buttonr, buttons, buttont, buttonu, buttonv, buttonw, buttonx, buttony, buttonz, };             foreach (button btn in buttons)             {                 //common code buttons:                 btn.click += new eventhandler(buttons_click);             }         }          private void buttons_click(object sender, eventargs e)         {             button button = sender button;             char letter = button.text.tolower().tochararray()[0];            /*  if (!char.isletter(letter))             {                 button.enabled = true;                 messagebox.show("only letters.");                 return;             } */             if (word.contains(letter))             {                 char[] letters = word.tochararray();                  (int = 0; < letters.length; i++)                 {                     if (letters[i] == letter)                     {                         labels[i].text = letter.tostring();                     }                 }                  foreach(label label1 in labels)                 {                     if (label1.text == "_") return;                     messagebox.show("you won!");                     resetgame();                 }             }             else             {                 missedlabel.text += letter.tostring() + ", ";                 drawbodypart((bodyparts)amount);                 amount++;                 if (amount == 6)                 {                     messagebox.show("you lost. word was: " + word);                     resetgame();                 }             }         }     } } 

if u didn't provide access modifier method signature default private if trying access outside class show accessibility error.. need change access modifier default public.

note : if trying call method inside class won't problem else need change access modifier!!


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -