Not sure how to do this one...

I have a combobox that is bound to a datasource and I would like to add a entry to the tail end of the combobox that says "<Add New Item>" which, when clicked opens a wizard that will allow the user to add a new record to the underlying datasource.

I attached an image of what I'm talking about.

When I try to edit the Items property, I get an error saying "Cannot modify the Items collection when the DataSource property is set."

Unfortunately adding the "<Add New Item>" to the underlying datasource isn't really an option.

The other issue is, of course, that because it is in a databound object, when the underlying data source is updated, the text "<Add New Item>" should not be inserted into the underlying datasource.

Any suggestions would be welcome.

Recommended Answers

All 2 Replies

Pull the datasource into some collection (List<T> comes to mind) and add your item then bind the list to the control.

commented: :) +15

Not a bad idea!
I'll give that a go!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.