Solved

Setting the SelectedValue on a combobox

Posted on 2009-05-13
3
680 Views
Last Modified: 2013-12-17
Hi there,

Sorry if this question is quite basic but am pretty new to C#. I have a form which has several combos - the Groups combo is connected to the detail table whose columns are all foreign keys.
The other combo boxes on the form represent a column on this table (which are databound to their respective masters)

I'm trying to set the value of the other combo boxes  based on the value selected in the group combo - on change, i can get the datarow which gives me the id value for each column.

Is there any way i can use the ID value to set the selected value on say the Staff combo?

Thanks!
dsSaphireOra.tblGroupsRow  dr = this.dsSaphireOra.tblGroups.FindByPK_GROUP(cboGroup.SelectedValue);
 

cboStaff.SelectedValue = dr.FK_SALES_STAFF  //Doesn't work!!

Open in new window

0
Comment
Question by:Ignis2
  • 2
3 Comments
 
LVL 5

Expert Comment

by:bprojoe
ID: 24377555
Using the selected value will only work if you are using the combo box's valuemember property when binding the combo box to a dataset, datatable, etc.
0
 

Author Comment

by:Ignis2
ID: 24382571
That's what I think I've done?!
- pls see the attachment!
Combo.jpg
0
 

Accepted Solution

by:
Ignis2 earned 0 total points
ID: 24383049
It worked with a .ToString()!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

939 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

9 Experts available now in Live!

Get 1:1 Help Now