title: Getting value from listbox in another class
body: <p>I'm triying to get the value of the selected item in a listbox which is in another class from the one from I'm trying to get the data.</p>
  
  <p>What I do is the following:</p>
  
  <p>Calling class:</p>
  
  <pre><code>Form1 form = new Form1();
  
  var mail = form.getMail();
  var pass = form.getPass();
  </code></pre>
  
  <p>Main class:</p>
  
  <pre><code>public string getMail() {
  
      return this.listBoxMail.SelectedValue.ToString();
  }
  
  public string getPass()
  {
      return this.tb_pass.Text;
  }
  </code></pre>
  
  <p>Always getting NullReferenceException. <strong>I ALREADY KNOW</strong> what this error means, what I need is to solve it. Any idea about how to achieve this? Thanks in advance.</p>