Solved

c# winform combo box does not display database value

Posted on 2013-06-17
4
389 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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