title: DataGridView not showing columns from DataTable C#
body: <p>My GUI has a datagridview in Form1 and is supposed to be populated by data from a datatable that lives in a separate class. I have set up the binding source and data source, but when I run my GUI, the datagridview is blank and does not show the columns from my datatable. At this point I'm not storing any data for the rows, I just want to make sure my column headers get displayed.</p>
  
  <p>I have looked at all the following links and nothing has helped so far:</p>
  
  <p><a href="https://stackoverflow.com/questions/18856252/datagridview-not-showing-columns-data">DataGridView not showing Columns/Data</a></p>
  
  <p><a href="https://stackoverflow.com/questions/40265702/datagridview-not-showing-my-columns">DataGridView not showing my columns</a></p>
  
  <p><a href="https://stackoverflow.com/questions/19114635/how-to-bind-datatable-to-datagridview-in-c-sharp">how to bind datatable to datagridview in c#</a></p>
  
  <p><a href="https://stackoverflow.com/questions/900112/datagridview-does-not-display-datatable">DataGridView does not display DataTable</a></p>
  
  <p>Here's my code</p>
  
  <p>Form1.cs:</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.Runtime.InteropServices;
  using Excel = Microsoft.Office.Interop.Excel;
  
  public Form1()
  {
      InitializeComponent();
      DataTable dataTable = LightSensor.dtOptical;
      DGV.DataSource = dataTable;
  }
  </code></pre>
  
  <p>LightSensor.cs:</p>
  
  <pre><code>using System;
  using System.Data;
  using System.IO.Ports;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  public static DataTable dtOptical = new DataTable();
  BindingSource bindingSource = new BindingSource();
  
  private void OpticalDataSetup()
  {
      dtOptical.Columns.Add("Sequence");
      dtOptical.Columns.Add("Date");
      dtOptical.Columns.Add("Time");
  }
  private void OpticalDataRows()
  {
      DataRow row = dtOptical.NewRow();
  
      row = dtOptical.NewRow();
      row["Sequence"] = MeasSeq;
      row["Date"] = DateTime.Today.ToString("MM-dd-yyyy");
      row["Time"] = DateTime.Now.ToString("HH:mm:ss");
  
      dtOptical.Rows.Add(row);
      bindingSource.DataSource = dtOptical;
  }
  </code></pre>