c# dataGridView null reference exception
<p>I'm using this code: </p>

<pre><code>DataTable table = new DataTable();
table.Columns.Add("Title");
dataGridView1.DataSource = table;
</code></pre>

<p>to populate my <code>dataGridView</code> but I get a <code>null reference exception</code> when I set the <code>datasource</code>.</p>