Click here to Skip to main content
15,900,431 members
Home / Discussions / C#
   

C#

 
AnswerRe: File IO Permissions Pin
martin_hughes28-May-08 5:45
martin_hughes28-May-08 5:45 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 5:55
Lisa Zapson28-May-08 5:55 
QuestionDataGridViewRow Question Pin
Harvey Saayman28-May-08 2:44
Harvey Saayman28-May-08 2:44 
AnswerRe: DataGridViewRow Question Pin
paas28-May-08 4:46
paas28-May-08 4:46 
GeneralRe: DataGridViewRow Question Pin
Harvey Saayman28-May-08 20:52
Harvey Saayman28-May-08 20:52 
QuestionTwo properties in combobox pick list Pin
AndrusM28-May-08 2:12
AndrusM28-May-08 2:12 
AnswerRe: Two properties in combobox pick list Pin
JoeSharp28-May-08 2:35
JoeSharp28-May-08 2:35 
GeneralRe: Two properties in combobox pick list Pin
AndrusM28-May-08 23:31
AndrusM28-May-08 23:31 
Thank you.
I tried code below but dropdown list shows only code.
How to force it to show both code and name ?

Andrus.

using System.Collections.Generic;
using System.Windows.Forms;

class testForm : Form
{
    testForm()
    {
        ComboBox cm = new ComboBox()
        {
            ValueMember = "Code"
        };
        List<Product> prodList = new List<Product>();
        prodList.Add(new Product() { Code = "001", Name = "Wine", Cb = cm });
        prodList.Add(new Product() { Code = "002", Name = "Beer", Cb = cm });
        cm.DataSource = prodList;
        cm.DataBindings.Add("SelectedValue", prodList, "Code");
        Controls.Add(cm);
    }

    class Product
    {
        public string Code { get; set; }
        public string Name { get; set; }

        public override string ToString()
        {
            return Code + " " + Name;
        }

    }

    static void Main()
    {
        Application.Run(new testForm());
    }
}


Andrus

GeneralRe: Two properties in combobox pick list Pin
JoeSharp28-May-08 23:53
JoeSharp28-May-08 23:53 
GeneralRe: Two properties in combobox pick list Pin
AndrusM29-May-08 3:14
AndrusM29-May-08 3:14 
AnswerRe: Two properties in combobox pick list Pin
carbon_golem28-May-08 2:36
carbon_golem28-May-08 2:36 
Question[Message Deleted] Pin
Sarfraz Munna28-May-08 1:53
Sarfraz Munna28-May-08 1:53 
AnswerRe: Observations between VB.NET and VC#.NET? Pin
Gareth H28-May-08 1:57
Gareth H28-May-08 1:57 
AnswerRe: Observations between VB.NET and VC#.NET? Pin
DaveyM6928-May-08 1:59
professionalDaveyM6928-May-08 1:59 
JokeRe: Observations between VB.NET and VC#.NET? Pin
Vasudevan Deepak Kumar28-May-08 2:43
Vasudevan Deepak Kumar28-May-08 2:43 
AnswerRe: Observations between VB.NET and VC#.NET? Pin
MarkB77728-May-08 2:21
MarkB77728-May-08 2:21 
JokeRe: Observations between VB.NET and VC#.NET? Pin
Vasudevan Deepak Kumar28-May-08 2:42
Vasudevan Deepak Kumar28-May-08 2:42 
AnswerNope. Pin
CPallini28-May-08 2:33
mveCPallini28-May-08 2:33 
QuestionDriver Pin
Pankaj Sardana28-May-08 1:32
Pankaj Sardana28-May-08 1:32 
AnswerRe: Driver Pin
benjymous28-May-08 1:37
benjymous28-May-08 1:37 
AnswerRe: Driver Pin
Sam Xavier28-May-08 23:11
Sam Xavier28-May-08 23:11 
QuestionHow to get a popup in Window Application Pin
Member 369905328-May-08 1:20
Member 369905328-May-08 1:20 
AnswerRe: How to get a popup in Window Application Pin
leppie28-May-08 1:27
leppie28-May-08 1:27 
Questionusing timer to switch an alert on and off Pin
steve_rm28-May-08 0:51
steve_rm28-May-08 0:51 
AnswerRe: using timer to switch an alert on and off Pin
leppie28-May-08 1:17
leppie28-May-08 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.