Click here to Skip to main content
15,913,709 members
Home / Discussions / C#
   

C#

 
QuestionFile IO Permissions Pin
Lisa Zapson28-May-08 3:18
Lisa Zapson28-May-08 3:18 
AnswerRe: File IO Permissions Pin
leppie28-May-08 3:34
leppie28-May-08 3:34 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 3:47
Lisa Zapson28-May-08 3:47 
GeneralRe: File IO Permissions Pin
leppie28-May-08 4:00
leppie28-May-08 4:00 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 4:50
Lisa Zapson28-May-08 4:50 
GeneralRe: File IO Permissions Pin
leppie28-May-08 6:37
leppie28-May-08 6:37 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 8:20
Lisa Zapson28-May-08 8:20 
GeneralRe: File IO Permissions Pin
leppie28-May-08 21:31
leppie28-May-08 21:31 
AnswerRe: File IO Permissions Pin
Gareth H28-May-08 3:42
Gareth H28-May-08 3:42 
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 
I need select from list containing product code and name but show only code in combo textbox.

Tried code below but dropdown list shows only code.
How to display both code AND name in selection list ?

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

class testForm : Form
{
    testForm()
    {
        ComboBox cm = new ComboBox() { DisplayMember = "DisplayMember", 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 ComboBox Cb;
        public string Code { get; set; }
        public string Name { get; set; }

        public string DisplayMember
        {
            get
            {
                if (Cb.DroppedDown)
                    return Code + " " + Name;
                else
                    return Code;
            }
        }
    }

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


Andrus

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 
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 

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.