Solved

c# winform combo box does not display database value

Posted on 2013-06-17
4
388 Views
Last Modified: 2013-06-18
I have a 2 combo boxes on my form.

cboCurPartNum
Data Source  - curpartBindingSource
Display Member - PartNum
Value Member - Part Num
Selected Value - engordbindingsource - curpartnum

cboPrePartNum
Data Source  - prepartBindingSource
Display Member - PartNum
Value Member - Part Num
Selected Value - engordbindingsource - prepartnum

When the form is loaded a object "engord" contains all the data for the selected engineering order and this gets binded to "engordbindingsource".  the fields engord.curpartnum and engord.prepartnum populate
cbocurpartnum and cboprepartnum, respectively.

for some reason only the cbocurpartnum is working.

cboprepartnum does not work - it will not select the value from engordbindingsource - prepartnum

What am I missing?
0
Comment
Question by:ndornack
  • 3
4 Comments
 

Author Comment

by:ndornack
ID: 39255120
I have inserted a breakpoint and see the SelectedItem property is coming back with null.  Any idea why SelectedItem would be coming back at null?
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 39255814
is prepartBindingSource filled with values? are the field names the same as the other datasource?
0
 

Author Comment

by:ndornack
ID: 39256135
Yes, prepartBindingSource is filled with values.  If I set the SelectedText property, the value from engordBindingSource.prepartnum is displayed.  However, when you select the dropdown and value is not selected on in the list, which is coming from prepartBindingSource.
0
 

Author Closing Comment

by:ndornack
ID: 39256156
I had to trim the data before assigning to the combo box.  Now its working.  Thanks for your comment.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
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 …

809 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