title: Function is inaccessible due to its protection level in C#
body: <p>I am working on a Windows Form Apps where I have a <code>TextBox</code> and I have an event of <code>textBox1_KeyDown</code> that triggers a function, that is in another class, that is called after calling its OBJECT and all settings are default. However I am getting the below error as...</p>
  
  <blockquote>
    <p>Error CS0122  'ClassName.FunctionName(object, KeyEventArgs)' is
    inaccessible due to its protection level</p>
  </blockquote>
  
  <p>Now my Main Form code is something like below...</p>
  
  <pre><code>namespace NewDEMOApps
  {
      public partial class MainForm : Form
      {
          ClassName newObj = new ClassName();
  
          public MainForm()
          {
              InitializeComponent();
          }
  
          private void textBox1_KeyDown(object sender, KeyEventArgs e)
          {
              newObj.FunctionName(sender, e);
          }       
      }
  }
  </code></pre>
  
  <p>And my Class code is something like below...</p>
  
  <pre><code>namespace NewDEMOAppsClass
  {
      public class ClassName
      {
          private void FunctionName(object sender, KeyEventArgs e)
          {
              if (true)
              {
                  if (e.KeyCode.Equals(Keys.Up))
                  {
                      MessageBox.Show(UP Key Pressed);
                  }
                  if (e.KeyCode.Equals(Keys.Down))
                  {
                      MessageBox.Show(DOWN Key Pressed);
                  }
                  if (e.KeyCode.Equals(Keys.Enter))
                  {
                      MessageBox.Show(Enter Key Pressed);
                  }
                  e.Handled = true;
              }
          }
      }
  }
  </code></pre>
  
  <p>Now I want to fix this out via pragmatically not by editing/changing the GUI settings in Visual Studio etc. So, can I do anything to fix this?</p>