Delen via


ListBox.SelectAll Method

Definition

Selects all the items in the ListBox control.

public:
 virtual void SelectAll() = SelectAll;
void SelectAll();
public void SelectAll();
function selectAll()
Public Sub SelectAll ()

Examples

if (listBox.SelectionMode != SelectionMode.Single)
{
    listBox.SelectAll();
}
if (listBox().SelectionMode() != Windows::UI::Xaml::Controls::SelectionMode::Single)
{
    listBox().SelectAll();
}
if (listBox->SelectionMode != SelectionMode::Single)
{
    listBox->SelectAll();
}
If listBox.SelectionMode <> SelectionMode.Single Then
    listBox.SelectAll()
End If

Remarks

Warning

The SelectAll method should only be called when the SelectionMode property is set to Multiple or Extended. If SelectAll is called when the SelectionMode is Single, an exception is thrown.

Applies to