?
Solved

ComboBox, fill Value and Display text

Posted on 2003-03-03
3
Medium Priority
?
465 Views
Last Modified: 2012-06-27
I need to populate a combo box on a windows form with key/value pairs manually. I do not want to do it binding to a query. How then can I set the Value and the Text for the item added??? Shouldn't this be pretty straight forward?
0
Comment
Question by:tpatten
3 Comments
 
LVL 2

Expert Comment

by:wiseguy_2112
ID: 8059439
The Windows ComboBox doesn't have a Value property in its collection.  It is just a list of strings.  To add an item...

comboBox1.Items.Add("string");
0
 
LVL 28

Accepted Solution

by:
iboutchkine earned 60 total points
ID: 8059532
It has DisplayMember and ValueMember. This is a string that specifies the property of the data source whose contents you want to display.
I think that you can do it only from the dataSource such as datatable

0
 
LVL 1

Author Comment

by:tpatten
ID: 8064754
Thanks for the input. What a frustrating way to go about it!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

569 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