title: Returning a List from my database class to a form in c#
body: <p>In a form i want to have a combobox filled With names that are in my database. 
  Everything directly to do with the database happens in my dedicated database class. I want the answers that come up from my sql query to go to the form and display in my combo box. </p>
  
  <p>This is what i have so far:</p>
  
  <pre><code>public string categories()
      {
          InitializeDatabase();
          connection.Open();
          string query = "SELECT Name FROM Categories";
          SqlCommand cmd = new SqlCommand(query, connection);
          using (SqlDataReader reader = cmd.ExecuteReader())
          {
              while (reader.Read())
              {
                  catList.Add(reader.GetString(0));
              }
          }
          return catList;
      }
  </code></pre>
  
  <p>As my discovered i cannot simply return a list too bad. 
  but im really in a ditch on how it should go to work. The results need to be displayed in the combobox thats on my other form where there isnt really any code yet </p>
  
  <pre><code>    public partial class AddImage : Form
  {
      DatabaseConnector databaseConnector = new DatabaseConnector();
      public AddImage()
      {
          InitializeComponent();
          databaseConnector.categories();
      }
  }
  </code></pre>
  
  <p>Thank you in advance!</p>