?
Solved

Setting the SelectedValue on a combobox

Posted on 2009-05-13
3
Medium Priority
?
723 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

777 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