Click here to Skip to main content
15,923,051 members
Home / Discussions / C#
   

C#

 
GeneralRe: NDoc-C# Documentation Pin
MozhdehQeraati13-Jun-06 21:25
MozhdehQeraati13-Jun-06 21:25 
GeneralRe: NDoc-C# Documentation Pin
Dustin Metzgar14-Jun-06 1:38
Dustin Metzgar14-Jun-06 1:38 
QuestionHelpButton click event Pin
haimh13-Jun-06 2:15
haimh13-Jun-06 2:15 
QuestionCalling Oracle 9i procedures using the enterprise library Pin
Mohamed El Gohary13-Jun-06 1:58
Mohamed El Gohary13-Jun-06 1:58 
Question------ RE:Send Mail Without Using SMTP Server ---- Pin
Sushant Duggal13-Jun-06 1:50
Sushant Duggal13-Jun-06 1:50 
QuestionAdd UserControl to HelpProvider Pin
haimh13-Jun-06 1:38
haimh13-Jun-06 1:38 
QuestioncomboBox items values Pin
andrei_dalcu13-Jun-06 1:38
andrei_dalcu13-Jun-06 1:38 
AnswerRe: comboBox items values [modified] Pin
SeMartens13-Jun-06 1:53
SeMartens13-Jun-06 1:53 
Hi,

what I normally do is that i create a class that will represent an item in the combobox. The combobox uses the ToString() method if you add an object to it. So i propose something like this for you:

<br />
class ComboBoxItem {<br />
        <br />
       private string sText = null;<br />
       private int iValue = 0;<br />
<br />
       public ComboBoxItem(string sText, int iValue) {<br />
          this.sText = sText;<br />
          this.iValue = iValue;<br />
       }<br />
<br />
        public string Text { get { return this.sText; } }<br />
        public int Value { get { return this.iValue; } }<br />
<br />
        public override ToString() {<br />
           return this.sText;<br />
        }<br />
<br />
   <br />
}<br />


now you can do something like this:

<br />
  comboBox1.Items.Add(new ComboBoxItem("Item1", 5));<br />


and to retrieve the selected value you do that:

<br />
   int iSelectedValue = ( (ComboBoxItem) (comboBox1.SelectedItem)).Value<br />


Hope this helps (don't hesitate to ask again if not).

Regards
Sebastian

P.S.: Does somebody know how to do tabs inside the code? (when posting for codeproject)


-- modified at 7:54 Tuesday 13th June, 2006
GeneralRe: comboBox items values Pin
andrei_dalcu13-Jun-06 2:02
andrei_dalcu13-Jun-06 2:02 
QuestionTextboxes Pin
Rmokkenstorm13-Jun-06 0:38
Rmokkenstorm13-Jun-06 0:38 
QuestionRichTextbox Text color Pin
alwz_nikhil13-Jun-06 0:34
alwz_nikhil13-Jun-06 0:34 
AnswerRe: RichTextbox Text color Pin
stancrm13-Jun-06 0:53
stancrm13-Jun-06 0:53 
QuestionTimer display Pin
ybasha12-Jun-06 23:41
ybasha12-Jun-06 23:41 
QuestionList all web methods in a .asmx file Pin
compdesign12-Jun-06 23:27
compdesign12-Jun-06 23:27 
AnswerRe: List all web methods in a .asmx file Pin
Dustin Metzgar13-Jun-06 3:52
Dustin Metzgar13-Jun-06 3:52 
GeneralRe: List all web methods in a .asmx file Pin
compdesign14-Jun-06 1:03
compdesign14-Jun-06 1:03 
GeneralRe: List all web methods in a .asmx file Pin
Dustin Metzgar14-Jun-06 3:15
Dustin Metzgar14-Jun-06 3:15 
GeneralRe: List all web methods in a .asmx file [modified] Pin
compdesign14-Jun-06 19:53
compdesign14-Jun-06 19:53 
GeneralRe: List all web methods in a .asmx file Pin
Dustin Metzgar15-Jun-06 3:53
Dustin Metzgar15-Jun-06 3:53 
Questiongetting DialogResults from non modal Dialog Pin
PaulaM12-Jun-06 23:04
PaulaM12-Jun-06 23:04 
AnswerRe: getting DialogResults from non modal Dialog Pin
SeMartens12-Jun-06 23:18
SeMartens12-Jun-06 23:18 
AnswerRe: getting DialogResults from non modal Dialog Pin
rah_sin12-Jun-06 23:21
professionalrah_sin12-Jun-06 23:21 
QuestionSetting data type of column in DataGridView Pin
Mairaaj Khan12-Jun-06 22:05
professionalMairaaj Khan12-Jun-06 22:05 
QuestionAccess enums defined in a header file Pin
beap12-Jun-06 21:44
beap12-Jun-06 21:44 
AnswerRe: Access enums defined in a header file Pin
stancrm12-Jun-06 21:49
stancrm12-Jun-06 21:49 

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.