Click here to Skip to main content
15,790,645 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
Hi everybody,

Following is my code

class CItemList
            public string Name;
            public long Value;

            public CNameList(string name, long value)
                Name = name;
                Value = value;

            public override string ToString()
                 Generates the text shown in the combo box
                return Name;

with which i am adding values to both 1) combo_box_1 and 2) combo_box_2.
I am able to retrieve the ID from combo_box_1.
Now, I would like to know how I can set the values of combo_box_2 based on this ID.
Was simple in VB.Net. But unable to figure it out in C#.Net. Please help. Thank you in advance.
Updated 1-Feb-16 5:14am
tiagu 1-Feb-16 10:05am    
Actually I want to set the name in the comboBox where the value equals the ID
CHill60 1-Feb-16 10:16am    
If it was simple in then have you considered using one of the free translators to convert what you have working to C# - you can then compare that output to the code you have written. The code you have provided does very little indeed.
Sinisa Hajnal 1-Feb-16 11:39am    
It is exactly the same in C#...syntax is different, yes, but events and objects behave the same way (CLR = *COMMON* language runtime) should be near zero effort to convert it.
Sergey Alexandrovich Kryukov 1-Feb-16 10:30am    
First, what is "ComboBox"? Which one? Full type name, please.
The problem looks very simple. What have you tried so far?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900