title: How do I populate a 'asp:ListBox' with an array of strings?
body: <p>I have an <code>asp:Listbox</code> that I need to switch out the items on depending on user selection. Here is what I have tried:</p>
  
  <pre><code> string[] my2012Departments = new string[5];
              my2012Departments[0] = "Administration"; 
              my2012Departments[1] = "Imaging Services"; 
              my2012Departments[2] = "IT"; 
              my2012Departments[3] = "Lab"; 
              my2012Departments[4] = "Support Services";
              lstDSYDepartment.Items.AddRange(my2012Departments.ToArray()); 
             //The AddRange will also not work without .ToArray() 
  </code></pre>
  
  <p>This however causes the following errors:</p>
  
  <p><strong><em>1. Cannot Convert from 'string[]' to 'System.Web.UI.WebControls.ListItem[]'</em></strong></p>
  
  <p><strong><em>2.The best overloaded method match for ....AddRange.... has some invalid arguments</em></strong></p>
  
  <p>According to <a href="http://msdn.microsoft.com/en-us/library/aa288424(v=vs.71).aspx" rel="nofollow">the documentation</a> this should work as long as I put the code in the form load.  </p>