Solved

c# winform combo box does not display database value

Posted on 2013-06-17
4
382 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
Comment Utility
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 69

Accepted Solution

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

Author Comment

by:ndornack
Comment Utility
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
Comment Utility
I had to trim the data before assigning to the combo box.  Now its working.  Thanks for your comment.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now