I'm getting this error message ("No row can be added to a DataGridView control that does not have columns. Columns must be added first.") but I can't see anything wrong with my code. I swear I've done this hundreds of times but something is wrong.
class ViewItem {
public string Name;
public string Value;
}
...
BindingList<ViewItem> list= new BindingList<ViewItem>();
dataGridView.DataSource = list;
ViewItem vi = new ViewItem(){Name = "Foo", Value = "Bar"};
list.Add(vi);
/// error here !