By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Three problems with custom DataGridView column

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.