Advertisement

05.02.2008 at 07:05AM PDT, ID: 23371616
[x]
Attachment Details

C# Forms ListBox not displaying DisplayMember Value

Asked by HubertFarnsworth in Microsoft Visual C#.Net, Visual Studio .NET 2005

Tags: Microsoft, Visual Studio, 2005, C#

Hello All -
I have a C# Forms app with a listbox I am populating from the DB via a DataSet. The SQL statement returns just two columns. I thought I was setting the DisplayMember and ValueMember correctly, but the listbox displays the column I specified as ValueMember. Here is the code with 'list' being my DataSet:

listBoxClientList.DataSource = list.Tables[0];
listBoxClientList.DisplayMember = "STRSTRING";
listBoxClientList.ValueMember = "ID";

The ID column is what I end up seeing in the listbox. I've debugged this and everything seems OK.

Any assistance would be appreciated.Start Free Trial
[+][-]05.02.2008 at 07:09AM PDT, ID: 21486773

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, Visual Studio .NET 2005
Tags: Microsoft, Visual Studio, 2005, C#
Sign Up Now!
Solution Provided By: p_davis
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628