The analogous list type is
System.Windows.Forms.ListBox
. A much more advanced control is
System.Windows.Forms.ListView
:
http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.aspx[
^].
First, class does not need list items. Instead, you can use object of any type. This is very important, because you can store any data in the item. Many beginners don't understand it and tend to store strings representing data instead the data itself, and then suffer extracting data. You really should store actual data in
Items
. The only question is: what string is shown in the UI? The answer is simple: whatever the virtual method
ToString
returns. So, you can control this text by overriding
System.Object.ToString()
of your item type, which can be any structure or class. Of course, you can store just strings, in some simple cases.
The second class does have the item type,
ListViewItem
, but also a concept of sub-item,
ListViewItem.SubItems
. If you need it, see the code sample on the page referenced above.
—SA