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 / .NET Framework / ADO.NET / April 2006

Tip: Looking for answers? Try searching our database.

combobox binding problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fanor - 27 Apr 2006 15:34 GMT
I have a combo box bound to a binding source wich is bound to a table. For
some reason the selectedvalue of the combo box doesn't show the correctt
value of the row the first time the form is showed. When I move to the next
row using a binding navigator the combobox selectedvalue have the correct
value and come back to the first record and it shows the correct value.

For instance if the field value is 2, the combobox selectedvalue is 0, it
looks that the binding is not working yet.
I tried using combobox.refresh() and changinng bindingsource.position  on
the form_load and still doesn't work.

I also have other forms using combo box and they work without any problem.

I have setup displaymember and value member.

Any help is very appreciated.
Andrew Oliner - 27 Apr 2006 19:57 GMT
I'm having the same problem. I haven't really dug into it yet, but I'm
worried that it's this:
http://www.jelovic.com/weblog/e107.htm

If it is, he lists this bug as still unfixed.

Ok, poking around a little more got me this:

   Can be fixed by binding a ComboBox to the SelectedItem property instead
of the Text property. For example:
   cboTest.DataBindings.Add("SelectedItem", dsTest, "MyTable.MyColumn");

Haven't had a chance to try it yet.

>I have a combo box bound to a binding source wich is bound to a table. For
> some reason the selectedvalue of the combo box doesn't show the correctt
[quoted text clipped - 13 lines]
>
> Any help is very appreciated.
Andrew Oliner - 27 Apr 2006 23:13 GMT
I was wrong. I was not having this issue at all. I had a line in my
form_load which read

myCombo.text = ""

The intent was to have a new record show a blank in the Combo, but it was
getting called every time the form displayed the first record.

> I'm having the same problem. I haven't really dug into it yet, but I'm
> worried that it's this:
[quoted text clipped - 28 lines]
>>
>> Any help is very appreciated.
fanor - 28 Apr 2006 02:46 GMT
I solved this problem, in form_load I changed by code the selectedindex of
the combobox, because in this case the valuemember is zero based.

>I have a combo box bound to a binding source wich is bound to a table. For
> some reason the selectedvalue of the combo box doesn't show the correctt
[quoted text clipped - 13 lines]
>
> Any help is very appreciated.

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.