Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

c# winform combo box does not display database value

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
ndornack
Asked:
ndornack
  • 3
1 Solution
 
ndornackAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
is prepartBindingSource filled with values? are the field names the same as the other datasource?
0
 
ndornackAuthor Commented:
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
 
ndornackAuthor Commented:
I had to trim the data before assigning to the combo box.  Now its working.  Thanks for your comment.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now