Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: comboBox with value & text Pin
wasife10-Jul-06 8:35
wasife10-Jul-06 8:35 
QuestionView Images Advice Pin
tadhg8810-Jul-06 5:08
tadhg8810-Jul-06 5:08 
AnswerRe: View Images Advice Pin
Judah Gabriel Himango10-Jul-06 5:15
sponsorJudah Gabriel Himango10-Jul-06 5:15 
GeneralRe: View Images Advice Pin
tadhg8810-Jul-06 5:39
tadhg8810-Jul-06 5:39 
GeneralRe: View Images Advice Pin
Not Active10-Jul-06 5:43
mentorNot Active10-Jul-06 5:43 
GeneralRe: View Images Advice Pin
tadhg8810-Jul-06 6:19
tadhg8810-Jul-06 6:19 
GeneralRe: View Images Advice Pin
Not Active10-Jul-06 6:46
mentorNot Active10-Jul-06 6:46 
GeneralRe: View Images Advice [modified] Pin
tadhg8810-Jul-06 7:19
tadhg8810-Jul-06 7:19 
QuestioncomboBox without change value Pin
TAREQ F ABUZUHRI10-Jul-06 5:00
TAREQ F ABUZUHRI10-Jul-06 5:00 
AnswerRe: comboBox without change value Pin
Dustin Metzgar10-Jul-06 5:11
Dustin Metzgar10-Jul-06 5:11 
AnswerRe: comboBox without change value Pin
Josh Smith10-Jul-06 5:12
Josh Smith10-Jul-06 5:12 
GeneralRe: comboBox without change value Pin
TAREQ F ABUZUHRI10-Jul-06 5:17
TAREQ F ABUZUHRI10-Jul-06 5:17 
GeneralRe: comboBox without change value Pin
TAREQ F ABUZUHRI10-Jul-06 5:21
TAREQ F ABUZUHRI10-Jul-06 5:21 
QuestionNotSupportedException was unhandled Pin
donkaiser10-Jul-06 4:59
donkaiser10-Jul-06 4:59 

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.