title: Bind list to gridview C#
body: <p>I'm trying to bind list to <code>gridview</code>. Situation is like this: I take data from .txt file, later I put it inside first list <code>List&lt;Mycolumns&gt;</code>. I have data in list (with 3 separated columns) that I created. I am taking data from one of the columns called <code>System_Description</code>. Now I would like  to show this data in <code>gridview</code>, but only thing that I get is length of each row. How should I fix it? Here is my code.</p>
  
  <pre><code>private void button7_Click(object sender, EventArgs e)
      {
          List&lt;MyColumns&gt; list = new List&lt;MyColumns&gt;();
  
          OpenFileDialog openFile1 = new OpenFileDialog();
          openFile1.Multiselect = true;
  
          if (openFile1.ShowDialog() != DialogResult.Cancel)
          {
              foreach (string filename in openFile1.FileNames)
              {
                  using (StreamReader sr = new StreamReader(filename))
                  {
                      string line;
                      while ((line = sr.ReadLine()) != null)
                      {
                          string[] _columns = line.Split(",".ToCharArray());
                          MyColumns mc = new MyColumns();
                          mc.Time = _columns[0];
                          mc.System_Description = _columns[1];
                          mc.User_Description = _columns[2];
                          list.Add(mc);
                      }
                  }
              }
              DataTable ListAsDataTable = BuildDataTable&lt;MyColumns&gt;(list);
              DataView ListAsDataView = ListAsDataTable.DefaultView;
              this.dataGridView1.DataSource = view = ListAsDataView;
              this.dataGridView1.AllowUserToAddRows = false;
              dataGridView1.ClearSelection();
          }
  
          List&lt;string&gt; description = list.Select(x =&gt; x.System_Description).ToList&lt;string&gt;();
          this.dataGridView2.DataSource = description;
  
      }
  class MyColumns
  {
      public string Time { get; set; }
      public string System_Description { get; set; }
      public string User_Description { get; set; }
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I've read that <code>DataBind()</code> works for Web form, my app is desktop app. What should I do now?</p>