I'm using this code:
DataTable table = new DataTable();
table.Columns.Add("Title");
dataGridView1.DataSource = table;
to populate my dataGridView but I get a null reference exception when I set the datasource.
I'm using this code:
DataTable table = new DataTable();
table.Columns.Add("Title");
dataGridView1.DataSource = table;
to populate my dataGridView but I get a null reference exception when I set the datasource.
 
    
     
    
    Your dataGridView1 is most likely a NULL reference. To verify, set a breakpoint on the line and when you hit it, hover your mouse over dataGridView1.
