Solved

Binding colums from sql server to a combobox on a Toolstrip.

Posted on 2008-09-30
2
634 Views
Last Modified: 2012-08-14
Hi Experts,

I am just getting used to binding.  I have never bound data before, but since I moved from VB 6 to VB 2008 I am trying to take advantage of data binding.
Problem is I have added a toolstrip/toolbar to a form and can see how I can add a combobox to the toolbar, but was wondering if I could bind columns to this combobox so that when a user selects a value, the related data would appear on the form.  
I am not using the navigation type toolstrip, just a regular toolstrip.
An example would be great.

Thanks,

Sheri
0
Comment
Question by:Sheritlw
2 Comments
 
LVL 18

Accepted Solution

by:
Priest04 earned 500 total points
ID: 22638155
ToolStripComboBox control doesnt have a DataSource property, so you cant bind it. You could, however, populate it manually with data, and when user selects some item from ToolStripComboBox, use a SelectedIndexChanged event to populate data on the form.

Goran
0
 

Expert Comment

by:dgallimore
ID: 23536644
theres a better way...

toolstripcomboboxInstance.ComboBox.BindingContext = Me.BindingContext 'the important bit ;)
toolstripcomboboxInstance.ComboBox.DisplayMember = "something"
toolstripcomboboxInstance.ComboBox.ValueMember = "something else"
toolstripcomboboxInstance.ComboBox.DataSource = someDataSource
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now