On Mon, 17 Dec 2007 12:35:20 -0800, Dom <do********@gmail.comwrote:
When I step through the code, using "Step into", I can see that the
line "DataGridView.Rows.Add (r) is calling the constructor. Also,
before I had a parameterless constructor, I got the error "No
paramterless constructor for this control", or something like that.
Well, without a complete code example, I'm afraid I don't really
understand. I'm not an expert in the use of the DataGridView control
myself and I've never tried to subclass the DataGridViewRow type.
That said, until you can come up with a complete code example to post, you
might want to look at this page:
http://msdn2.microsoft.com/en-us/library/ha5xt0d9.aspx
Particular interesting is probably the discussion of shared rows. You may
be running into some situation where the DataGridView is trying to create
a new row for use as a shared row. However, the row instance you've added
should _also_ still be in the DataGridView.
So, it might be expected (I'm not sure) that the parameterless constructor
for your subclass is required and used, but I would hope that the instance
you already created would still be properly added to the DataGridView
control.
Other than the unexpected instantiation of a new instance of your class,
does the control work correctly? If so, I'd guess this is working as
designed.
Pete