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 / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Selecting a value in a bound combobox?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Magnus Bergh - 27 Jun 2007 18:34 GMT
I thought this was easy, just to SelectedValue in code for example
Combobox1.SelectedValue= "ABC". Looks on screen like it works and the
correct value shows in the combobox but the underlying datasource is not
updated.

It is like the usual order entry example where you have a combox
displaying customer names and selectedvalue bound to the order's
customerid and valuemember to customer id of customer bindingsource. So
what I want to do is to select the correct customer in the combobox
using the customer id.

What I did was instead to use the bindingsource.find method and set
position in bindingsource which seems to work fine.

For example:

index=CustomerBindingSource.Find("CustomerId", customerid)
if index <> -1 then CustomerBindingSource.Position= index

where customerid is the id of the customer I want to find.

Is this the correct method to do this?
Paul Emery - 29 Jun 2007 02:00 GMT
don't you have to have a line like
customerBindingSource.endedit()
to "apply pending changes to the underlying datasource" ?
Signature

Paul Emery
Data Base and Ecommerce Consultant
Michigan

> I thought this was easy, just to SelectedValue in code for example
> Combobox1.SelectedValue= "ABC". Looks on screen like it works and the
[quoted text clipped - 18 lines]
>
> Is this the correct method to do this?

Rate this thread:







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.