• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. List Controls > ListBox and CheckedListBox Controls

ListBox and CheckedListBox Controls

The ListBox is the quintessential list control, and many of the techniques we'll examine in this section apply equally well to the other list controls that we'll discuss in this chapter. The .NET Framework exposes two distinct ListBox classes—the ListBox and the CheckedListBox, which descends from the ListBox and inherits most of its functionality. Both controls descend from the ListControl class, which is also the parent of the ComboBox. We'll discuss the ListBox first, look at the differences in CheckedListBox at the end of the section, and examine the ComboBox in the next section.

The items in a ListBox are stored in its Items collection, an instance of the Listbox.ObjectCollection class, which contains generic Object items. You can bind the Items collection to a data source, or you can manually add items using the ObjectCollection's Add and AddRange methods. The two techniques are mutually exclusive—you cannot call the Add method once you have set a data source for the collection.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint