Click here to Skip to main content
15,912,578 members
Home / Discussions / C#
   

C#

 
QuestionSendMessage problem Pin
psyonara10-Jul-06 5:52
psyonara10-Jul-06 5:52 
AnswerRe: SendMessage problem Pin
LongRange.Shooter10-Jul-06 8:16
LongRange.Shooter10-Jul-06 8:16 
AnswerRe: SendMessage problem Pin
mav.northwind10-Jul-06 9:02
mav.northwind10-Jul-06 9:02 
QuestionHiding a control Pin
joshp121710-Jul-06 5:21
joshp121710-Jul-06 5:21 
AnswerRe: Hiding a control Pin
Ravi Bhavnani10-Jul-06 5:31
professionalRavi Bhavnani10-Jul-06 5:31 
GeneralRe: Hiding a control Pin
joshp121710-Jul-06 5:45
joshp121710-Jul-06 5:45 
GeneralRe: Hiding a control Pin
Ravi Bhavnani10-Jul-06 5:55
professionalRavi Bhavnani10-Jul-06 5:55 
GeneralRe: Hiding a control Pin
Jun Du10-Jul-06 5:59
Jun Du10-Jul-06 5:59 
GeneralRe: Hiding a control Pin
Christian Graus10-Jul-06 8:17
protectorChristian Graus10-Jul-06 8:17 
AnswerRe: Hiding a control Pin
Andrew Lygin10-Jul-06 8:48
Andrew Lygin10-Jul-06 8:48 
QuestionThis.Left Pin
joshp121710-Jul-06 5:11
joshp121710-Jul-06 5:11 
AnswerRe: This.Left Pin
Ravi Bhavnani10-Jul-06 5:17
professionalRavi Bhavnani10-Jul-06 5:17 
AnswerRe: This.Left Pin
Not Active10-Jul-06 5:19
mentorNot Active10-Jul-06 5:19 
GeneralRe: This.Left Pin
Judah Gabriel Himango10-Jul-06 6:27
sponsorJudah Gabriel Himango10-Jul-06 6:27 
GeneralRe: This.Left Pin
Not Active10-Jul-06 6:51
mentorNot Active10-Jul-06 6:51 
AnswerRe: This.Left Pin
wasife10-Jul-06 8:23
wasife10-Jul-06 8:23 
AnswerRe: This.Left Pin
Andrew Lygin10-Jul-06 9:14
Andrew Lygin10-Jul-06 9:14 
QuestioncomboBox with value & text Pin
TAREQ F ABUZUHRI10-Jul-06 5:09
TAREQ F ABUZUHRI10-Jul-06 5:09 
AnswerRe: comboBox with value & text Pin
TAREQ F ABUZUHRI10-Jul-06 5:20
TAREQ F ABUZUHRI10-Jul-06 5:20 
AnswerRe: comboBox with value & text Pin
Judah Gabriel Himango10-Jul-06 5:21
sponsorJudah Gabriel Himango10-Jul-06 5:21 
GeneralRe: comboBox with value & text Pin
TAREQ F ABUZUHRI10-Jul-06 5:22
TAREQ F ABUZUHRI10-Jul-06 5:22 
GeneralRe: comboBox with value and text Pin
Judah Gabriel Himango10-Jul-06 6:24
sponsorJudah Gabriel Himango10-Jul-06 6:24 
So your problem, if I understand correctly, is that you need to attach an integer to a combo box item. This is pretty easy:

private class MyComboBoxItem
{
    public readonly string Text;
    public readonly int Value

    public MyComboBoxItem(string text, int value)
    {
        this.Text = text;
        this.Value = value;
    }

    public override string ToString()
    {
        return this.Text;
    }
}


// Code to add the "France" item to the combo box
MyComboBoxItem france = new MyComboBoxItem("France", 5);
myComboBox.Items.Add(france);


// The event handler that handles selection changed event.
void myComboBox_SelectedValueChanged(object sender, EventArgs e)
{
    MyComboBoxItem selectedItem = (MyComboBoxItem)myComboBox.SelectedItem;
    int value = selectedItem.Value;
}


Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul

Judah Himango


GeneralRe: comboBox with value and text Pin
TAREQ F ABUZUHRI10-Jul-06 9:40
TAREQ F ABUZUHRI10-Jul-06 9:40 
GeneralRe: comboBox with value and text Pin
Judah Gabriel Himango10-Jul-06 10:08
sponsorJudah Gabriel Himango10-Jul-06 10:08 
GeneralRe: comboBox with value & text Pin
TAREQ F ABUZUHRI10-Jul-06 5:23
TAREQ F ABUZUHRI10-Jul-06 5:23 

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.