Solved

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

Posted on 2008-09-30
2
636 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Getting multiple values from a dataset ASP.NET(VB) 3 50
Change Format on Data when exporting to Excel 4 33
C# Single Form 8 42
Get the selected ValueMember of Combobox 5 31
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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