Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / May 2006

Tip: Looking for answers? Try searching our database.

databinding combobox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank - 26 May 2006 19:58 GMT
Hi, I'm trying to build my first vb2005 dataapp but I'm somewhat lost here. I
have a database table displayed in a grid. This table has a field called
countryid which is linked to another table with the actual countrynames. On
the same form I have a combobox which should be linked to both tables in
order to display the names. In VB6 this was done easily through .datafield,
.boundcolumn and listfield. How should I do this in vb2005?

Thanks,
Frank
Eric Moreau - 28 May 2006 14:20 GMT
It is much the same in 2005.

You need 2 BindingSource:
   -BindingSource1 = The table that contains your linked field
   -BindingSource2 = YourCountryNamesTable

You then need to set 4 properties of the ComboBox:
-DataSource (BindingSource2)
-DisplayMember (The ID field from BindingSource2)
-ValueMember (The field you want to display from BindingSource2)
-SelectedValue (The ID field from BindingSource1)

Signature

HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Concept S2i inc. (www.s2i.com)
http://emoreau.s2i.com/

> Hi, I'm trying to build my first vb2005 dataapp but I'm somewhat lost
> here. I
[quoted text clipped - 8 lines]
> Thanks,
> Frank

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.