Click here to Skip to main content
15,897,968 members
Home / Discussions / C#
   

C#

 
AnswerRe: String to Binary Pin
0x3c010-Aug-09 23:19
0x3c010-Aug-09 23:19 
QuestionHow to add item to listbox control Pin
ademsandeepreddy10-Aug-09 22:59
ademsandeepreddy10-Aug-09 22:59 
AnswerRe: How to add item to listbox control Pin
padmanabhan N10-Aug-09 23:06
padmanabhan N10-Aug-09 23:06 
GeneralRe: How to add item to listbox control Pin
ademsandeepreddy10-Aug-09 23:23
ademsandeepreddy10-Aug-09 23:23 
GeneralRe: How to add item to listbox control Pin
padmanabhan N11-Aug-09 0:10
padmanabhan N11-Aug-09 0:10 
GeneralRe: How to add item to listbox control Pin
smiley300518-Aug-09 20:33
smiley300518-Aug-09 20:33 
AnswerRe: How to add item to listbox control Pin
Mohammad Dayyan10-Aug-09 23:13
Mohammad Dayyan10-Aug-09 23:13 
AnswerRe: How to add item to listbox control Pin
DaveyM6910-Aug-09 23:24
professionalDaveyM6910-Aug-09 23:24 
A ListBox takes an object for each item. The item's ToString method is called for the text that is displayed. To retrieve the initial object back, you just need to cast/convert it.
public class MyClass
{
    public MyClass(string text, int value)
    {
        Text = text;
        Value = value;
    }
    public string Text
    {
        get;
        set;
    }
    public int Value
    {
        get;
        set;
    }
    public override string ToString()
    {
        return string.Format("{0}, Value={1}", Text, Value);
    }
}
listBox.Items.Add(new MyClass("Hello World", 1));

// ...

MyClass myClass = listBox.Items[0] as MyClass;
MessageBox.Show(myClass.Text);


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: How to add item to listbox control Pin
ademsandeepreddy10-Aug-09 23:44
ademsandeepreddy10-Aug-09 23:44 
AnswerRe: How to add item to listbox control Pin
Saksida Bojan10-Aug-09 23:47
Saksida Bojan10-Aug-09 23:47 
GeneralRe: How to add item to listbox control Pin
DaveyM6910-Aug-09 23:50
professionalDaveyM6910-Aug-09 23:50 
Questionhtml in C# Pin
AndyInUK10-Aug-09 22:51
AndyInUK10-Aug-09 22:51 
AnswerRe: html in C# Pin
Eddy Vluggen10-Aug-09 23:12
professionalEddy Vluggen10-Aug-09 23:12 
GeneralRe: html in C# Pin
AndyInUK10-Aug-09 23:14
AndyInUK10-Aug-09 23:14 
GeneralRe: html in C# Pin
Eddy Vluggen10-Aug-09 23:38
professionalEddy Vluggen10-Aug-09 23:38 
GeneralRe: html in C# Pin
Pete O'Hanlon11-Aug-09 0:26
mvePete O'Hanlon11-Aug-09 0:26 
AnswerRe: html in C# [modified] Pin
0x3c010-Aug-09 23:32
0x3c010-Aug-09 23:32 
QuestionHow to load a button in taskbar through c# Pin
svt gdwl10-Aug-09 22:34
svt gdwl10-Aug-09 22:34 
AnswerRe: How to load a button in taskbar through c# Pin
Arindam Sinha10-Aug-09 23:07
Arindam Sinha10-Aug-09 23:07 
Questioncallbackoncollected delegated data Pin
Rajee Maharjan10-Aug-09 22:28
Rajee Maharjan10-Aug-09 22:28 
QuestionValidation on Texboxes dialog in Setup and deployment project Pin
248912810-Aug-09 21:53
248912810-Aug-09 21:53 
AnswerRe: Validation on Texboxes dialog in Setup and deployment project Pin
Arindam Sinha10-Aug-09 22:58
Arindam Sinha10-Aug-09 22:58 
Questionhow ı can do "I delete old folder with hours but my prog delete days" Pin
mehmetbilge10-Aug-09 21:23
mehmetbilge10-Aug-09 21:23 
AnswerRe: how ı can do "I delete old folder with hours but my prog delete days" Pin
0x3c010-Aug-09 21:57
0x3c010-Aug-09 21:57 
Questiondata gridview editing Pin
abdolrab10-Aug-09 21:03
abdolrab10-Aug-09 21:03 

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.