470,582 Members | 2,503 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,582 developers. It's quick & easy.

Three problems with custom DataGridView column

Hey everyone...

I've got three problems with a custom DataGridView column I've built
following the "How To: Host Controls in Windows Forms DataGridView
Cells" article. The base editing control is a ComboBox which is
similar to the built-in Combo column but will hopefully be more

First: I am using this control in multiple columns which _should_ hold
unique items. However, the items added to column A are visible in
column B, and so on. I'm initializing a new instance of the control
for each column and adding them manually. Why is this happening when
each column have a "new" instance?

MyComboCol colA = new MyComboCol();
MyComboCol colB = new MyComboCol();
MyComboCol colC = new MyComboCol();
// set column A properties
// set column B properties
// set column C properties

Second: As I type text into the control and leave the cell, the text
is automatically added to the Items collection if it doesn't already
exist. This behavior is occurring internally in the class using an
overriden OnLeave event. The problem is that when I move from column A
to column B or a built-in TextBoxColumn, the items in the column A
collection will disappear. I'm assuming that this is related to my
"First" problem, but I'm not certain. Any ideas why this would be

Third: I'm not able to access the "Items" collection by using
"colA.Items" like you would with DGVComboBoxColumn. I'm calling Base()
and Clone() in my controls class and have set everything to public in
hope that get access to it. How do I expose the EditingControl's
(Inherited ComboBox) Items collection from the Column class?

Thanks for your help,

Dec 15 '06 #1
0 2170

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Pete Davis | last post: by
3 posts views Thread by Tony K | last post: by
reply views Thread by Kevin S Gallagher | last post: by
3 posts views Thread by VC | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.