Solved

Setting the SelectedValue on a combobox

Posted on 2009-05-13
3
714 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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

690 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