Question ToolStripComboBox, DataSource?

JaedenRuiner

Well-known member
Joined
Aug 13, 2007
Messages
340
Programming Experience
10+
Okay, so a regular ComboBox can have a DataSource, a DatMember, DisplayMember and a ValueMember, and wow, I don't have to write anything. So then I see a BindingNavigator, which is a glorified ToolStrip() and I figure, "hey instead of putting my table list as a list box on the side of my form, I'll put it up top there.

But The only ComboBox allowed on a ToolStrip is the ToolStripComboBox. So where is the DataSource property for that one?

That is just poor programming to offer the functionality in one combo box but not in another, when they should be fundamentally the same control, just one is attached to a ToolStrip container and the other is attached to a Form Container. Frankly, i don't even see the need (or waste of time) creating two different types of everything for the "ToolStrip*" items. A button is a button, an Image is an Image, and all these controls are bound to containers so what do they care?
So, the resulting question: How can I manipulate the ToolStrip (like the BindingNavigator) to not only Contain a ComboBox (of whatever type) but to allow that ComboBox to utilize the Standard Control Bindings that exist in all of these databound controls?

Thanks
 
VB.NET:
        ToolStripComboBox1.ComboBox.DataSource = myDataSet.Tables(0)
        ToolStripComboBox1.ComboBox.DisplayMember = "columnName"
        ToolStripComboBox1.ComboBox.ValueMember = "columnName"
 
Awesome, thanks...

Though, i did notice a slight glitch.

ComboBox.Format event does not trigger (which I use to format the display name for the list)

I set the ToolStripComboBox.ComboBox.DataSource, and it works wonderfully, however, when I close the form (alt+f4, or the close button) i set the datasource of all my components to Nothing, and close out the form. But when I reopen the form, the ToolStripComboBox.ComboBox is nothing. Any reason why, or should I be doing something else on the form closing.

I need to be able to show the form, close the form, show it, close it, etc as many times as necessary, and I can't "set" the combobox property as it is readonly.

Thanks
 
Back
Top