title: Why is my method not working?
body: <p>I have a form with a <code>listView</code>, which is populated by calling the <code>showCheckedInFiles()</code> method. The method works perfectly fine when I add a simple button to the form and press it, which calls the method, but when I call the method from elsewhere it will not populate my <code>listview</code>.</p>
  
  <p>Please help it's driving me insane. The first method below is called from another class and that is shown underneath this, and I've included the button method as well for reference, as I say, the button works perfectly, but i need to be able to call the method without clicking a button!!:</p>
  
  <pre><code>public void openProject(string projectname)
  {
      projectName = projectname;
      string userDir = CSDBpath + projectname + "\\checkedOUT\\" + userName;
      if (!Directory.Exists(userDir)) //Does the user's directory exist, if not, create it
      {
          Directory.CreateDirectory(userDir);
      }
      showCheckedInFiles();
   }
  
   private void button3_Click(object sender, EventArgs e)
   {
      showCheckedInFiles();
   }
  </code></pre>
  
  <p>The method which calls the above:</p>
  
  <pre><code>private void buttonOpenProject_Click(object sender, EventArgs e)
  {
       ListView.SelectedListViewItemCollection mySelectedItems;
       mySelectedItems = listView1.SelectedItems;
       Form1 mainform = new Form1();
       string myProject = "";
  
       foreach (ListViewItem item in mySelectedItems)
       {
           myProject = item.Text;
       }
  
       mainform.openProject(myProject);
       //mainform.showCheckedInFiles();
       this.Close();
   }
  </code></pre>