title: How to bind list to dataGridView?
body: <p>I seem to be running around in circles and have been doing so in the last hours.</p>
  
  <p>I want to populate a datagridview from an array of strings. I've read its not possible directly, and that I need to create a custom type that holds the string as a public property. So I made a class:</p>
  
  <pre><code>public class FileName
      {
          private string _value;
  
          public FileName(string pValue)
          {
              _value = pValue;
          }
  
          public string Value
          {
              get 
              {
                  return _value;
              }
              set { _value = value; }
          }
      }
  </code></pre>
  
  <p>this is the container class, and it simply has a property with the value of the string. All I want now is that string to appear in the datagridview, when I bind its datasource to a List. </p>
  
  <p>Also I have this method, BindGrid() which I want to fill the datagridview with. Here it is:</p>
  
  <pre><code>    private void BindGrid()
      {
          gvFilesOnServer.AutoGenerateColumns = false;
  
          //create the column programatically
          DataGridViewTextBoxColumn colFileName = new DataGridViewTextBoxColumn();
          DataGridViewCell cell = new DataGridViewTextBoxCell();
          colFileName.CellTemplate = cell; colFileName.Name = "Value";
          colFileName.HeaderText = "File Name";
          colFileName.ValueType = typeof(FileName);
  
          //add the column to the datagridview
          gvFilesOnServer.Columns.Add(colFileName);
  
          //fill the string array
          string[] filelist = GetFileListOnWebServer();
  
          //try making a List&lt;FileName&gt; from that array
          List&lt;FileName&gt; filenamesList = new List&lt;FileName&gt;(filelist.Length);
          for (int i = 0; i &lt; filelist.Length; i++)
          {
              filenamesList.Add(new FileName(filelist[i].ToString()));
          }
  
          //try making a bindingsource
          BindingSource bs = new BindingSource();
          bs.DataSource = typeof(FileName);
          foreach (FileName fn in filenamesList)
          {
              bs.Add(fn);
          }
          gvFilesOnServer.DataSource = bs;
      }
  </code></pre>
  
  <p>Finally, the problem: the string array fills ok, the list is created ok, but I get an empty column in the datagridview. I also tried datasource= list&lt;> directly, instead of  = bindingsource, still nothing.</p>
  
  <p>I would really appreciate an advice, this has been driving me crazy.</p>