Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 January 23rd, 2004, 03:31 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default ComboBox, ListBox

Hello-

I am creating a WinForm that loads reports into a RichTextBox control. I want the user to be able to select the current report from a combobox or listbox.

I have the report information in a database. Some of the report Names are identical, but each row has a unique key value. I want the combobox (or listbox) to display the report name (no problem), but I want the value of the selection to be the unique key value (problem) like in ASP and ASPX with the dropdown list. Is there a way to do this? Thanks in advance for the help...I am on a tight deadline here.


Tim

 
Old January 23rd, 2004, 04:36 PM
Authorized User
 
Join Date: Jun 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you need to set the set the datasource

VB.Net

me.ListBox1.DataSource = dsData.tables(0)
me.ListBox1.DisplayMember = "Column Name"
me.ListBox1.ValueMember = "Column Name"

C#
this.ListBox1.DataSource = dsData.Tables(0);
this.ListBox1.DisplayMember = "Column Name";
this.ListBox1.ValueMember = "Column Name";

It's important for us to explain to our nation that life is important. It's not only life of babies, but it's life of children living in, you know, the dark dungeons of the Internet."— George W. Bush - Arlington Heights, Ill., Oct. 24, 2000





Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling a combobox/listbox unmeshraut VB How-To 1 September 21st, 2007 12:08 PM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
Filling Combobox with value from other Combobox ayazhoda Access VBA 6 June 5th, 2007 04:58 AM
ComboBox & ListBox usage venkikrao VB.NET 4 March 14th, 2006 07:50 AM
I'm back :) Listbox var from listbox MichaelTJ .NET Web Services 2 October 21st, 2003 07:06 PM





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