Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
GeneralRe: Exchange Server Address Book Pin
Corinna John6-Sep-04 3:41
Corinna John6-Sep-04 3:41 
GeneralSocket remote node disconnection Pin
Den2Fly5-Sep-04 18:08
Den2Fly5-Sep-04 18:08 
GeneralRe: Socket remote node disconnection Pin
Pradeep Shamarao5-Sep-04 21:47
Pradeep Shamarao5-Sep-04 21:47 
GeneralCustomizing a ListBox Pin
eggie55-Sep-04 16:58
eggie55-Sep-04 16:58 
GeneralRe: Customizing a ListBox Pin
mav.northwind6-Sep-04 2:35
mav.northwind6-Sep-04 2:35 
GeneralRe: Customizing a ListBox Pin
Werdna6-Sep-04 9:49
Werdna6-Sep-04 9:49 
GeneralRe: Customizing a ListBox Pin
eggie56-Sep-04 19:32
eggie56-Sep-04 19:32 
GeneralRe: Customizing a ListBox Pin
Werdna7-Sep-04 3:59
Werdna7-Sep-04 3:59 
If you add Customer to listbox, it just copies reference to that customer.
When listbox displays the customer, first it checks if you set "DisplayMember" to display, if you did, it will display that property. If not, it will call "ToString()" on the object to display it.
IF you override ToString() on customer, you'd see in the listbox whathever you return from that method.
Or implement properties on Customer (getter method) and set DisplayMember to the name of that property.
You should add Customer to the list, then you can cast that object:
Customer cust = new ....;
listbox.Items.Add(cust);
...
Customer selectedCust = (Customer)listbox.SelectedItem;

to get first name, in customer have:
public string FirstName
{
get{ return this.firstName; }
}

and in Form1() constructor (below initialize)
listbox.DisplayMember = "FirstName";

and now just add customers to the listbox.
GeneralRe: Customizing a ListBox Pin
eggie57-Sep-04 14:01
eggie57-Sep-04 14:01 
QuestionCan I use Visual C# Standard commercially? Pin
kusanagi20005-Sep-04 15:35
kusanagi20005-Sep-04 15:35 
AnswerRe: Can I use Visual C# Standard commercially? Pin
Christian Graus5-Sep-04 15:38
protectorChristian Graus5-Sep-04 15:38 
GeneralRe: Can I use Visual C# Standard commercially? Pin
kusanagi20005-Sep-04 16:33
kusanagi20005-Sep-04 16:33 
GeneralGradientPanel Pin
Asciono5-Sep-04 13:29
Asciono5-Sep-04 13:29 
GeneralRe: GradientPanel Pin
mav.northwind5-Sep-04 20:10
mav.northwind5-Sep-04 20:10 
GeneralMachine Info Pin
Moon Boy5-Sep-04 13:17
Moon Boy5-Sep-04 13:17 
GeneralRe: Machine Info Pin
eggie55-Sep-04 14:20
eggie55-Sep-04 14:20 
GeneralRe: Machine Info Pin
Mazdak5-Sep-04 20:39
Mazdak5-Sep-04 20:39 
GeneralRe: Machine Info Pin
heile6-Sep-04 19:10
heile6-Sep-04 19:10 
QuestionOnKeyDown not getting arrow keys ? Pin
Christian Graus5-Sep-04 12:30
protectorChristian Graus5-Sep-04 12:30 
AnswerRe: onkeydown not getting arrow keys ? Pin
Werdna6-Sep-04 9:53
Werdna6-Sep-04 9:53 
GeneralRe: onkeydown not getting arrow keys ? Pin
Christian Graus6-Sep-04 10:40
protectorChristian Graus6-Sep-04 10:40 
Generaldifferential comparison algo Pin
sho125-Sep-04 10:37
sho125-Sep-04 10:37 
GeneralRe: differential comparison algo Pin
Christian Graus5-Sep-04 12:31
protectorChristian Graus5-Sep-04 12:31 
GeneralRe: differential comparison algo Pin
mitchelle24-Oct-04 5:22
mitchelle24-Oct-04 5:22 
GeneralRe: differential comparison algo Pin
Christian Graus24-Oct-04 9:46
protectorChristian Graus24-Oct-04 9:46 

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.