Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2006, 05:24 PM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding value pairs to a combo box

Hey all,

I'm working on a form that receives a list of system descriptions and system codes. I need to populate a combobox with these system descriptions and set the value to the system code. Does anyone have a quick way to do this?

Thanks!

 
Old June 14th, 2006, 12:42 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

There can be a lot of ways to fill in a combo box, but it depends how you are receiving the system descriptions and system codes. Please be a bit more specific, so that appropriate resolution is provided.

Regards
Mike

 
Old February 25th, 2009, 06:10 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Post Adding value pairs to a combo box / listbox

See the following examples I came across when I googled...

http://www.dotnetspider.com/resources/19530-Key-Value-Functionality-Combo-Box.aspx
http://www.vbdotnetheaven.com/UploadFile/scottlysle/ExtendedListCtrlsVB03272007214253PM/ExtendedListCtrlsVB.aspx

In the first example you can access key/value using

KeyValuePair x = (KeyValuePair)listBox1.Items[listBox1.SelectedIndex];
MessageBox.Show(x.m_objKey.ToString());
MessageBox.Show(x.m_strValue.ToString());





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding data in a combo box from the database Gini Visual Studio 2008 0 June 20th, 2008 02:17 AM
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
adding my own combo box in datagridview drachx Pro Visual Basic 2005 0 January 27th, 2006 03:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.