ba272
asked on
Generating a ToString() value for a multi-column listbox.
Hi,
How do I separate the columns, in the ToString() return value? The tab? '\t'?
Thanks.
How do I separate the columns, in the ToString() return value? The tab? '\t'?
Thanks.
ToString() return value for which object?
ASKER
I add objects to a listbox, and the ToString() method for that object is called to provide the string to display for that object. That's the standard way to add an object to a listbox - you override ToString(), and whatever that object returns for ToStiring() will be displayed in the listbox.
My question is about multiple column listboxes. What character is used to diferentiate the columns?
My question is about multiple column listboxes. What character is used to diferentiate the columns?
ASKER
The answer is that Yes, it's the tab key which distinguishes one column from the next.
ASKER
I wasn't expecting it to be so easy.
Listbox has a property multicolumn in it. However that does not allow seperate multiple lists of items to be displayed in multiple columns. Setting this bool property has the effect of overflow items displayed in columns aligned next to each other with a horzonital scroll bar instead of in a single list with a vertical scroll bar.
To have "seperate" multiple columns use listview or the datagrid classes.
System.Windows.Forms.DataG rid
System.Windows.Forms.ListV iew
To have "seperate" multiple columns use listview or the datagrid classes.
System.Windows.Forms.DataG
System.Windows.Forms.ListV
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, that is sweet! Thanks.