I've created a UserControl comprised of two controls, a DataGridView
and a DateTimePicker. I've done this because one of the columns in
the DataGridView will hold a date, and when the user clicks on the
column, the DateTimePicker will appear.
Now for the problem.
I want the main program to add columns (and other properties) to the
DataGridView control. So I exposed the control, like this (where
dgvMain is the name of the DataGridView control in the UserControl):
public DataGridView GridControl
{
get {return dgvMain;}
}
This is fine. The properties box of the UserControl now has
"GridControl" which opens to the usual properties of a datagridview.
But when I click on "Columns" in the properties box, I get the message
"Object reference not set to an instance of an object." The odd thing
is, I can add columns in code. (Or maybe that's not so odd).
How do I handle this?
Dom