To understand the effect of setting the SelectedIndex property of a ListBox to -1, it is important to know how a ListBox works and the purpose of the SelectedIndex property.
A ListBox is a control that displays a list of items, and the SelectedIndex property represents the index of the currently selected item in the list. It is an integer value that can range from 0 to (number of items - 1).
Now, let's go through each option and explain why it is right or wrong:
A. cause an error: This option is incorrect. Setting the SelectedIndex property of a ListBox to -1 does not cause an error. It is a valid operation that can be performed.
B. cannot be done: This option is incorrect. It is possible to set the SelectedIndex property of a ListBox to -1. It is a valid value that represents no selected item in the list.
C. de-select any selected item: This option is correct. When the SelectedIndex property of a ListBox is set to -1, it deselects any previously selected item in the list. This means that no item in the list will be highlighted or considered as the currently selected item.
D. Both a and b: This option is incorrect. Setting the SelectedIndex property of a ListBox to -1 does not cause an error, and it can be done. Therefore, option D is not the correct answer.
E. All of the above: This option is incorrect. While setting the SelectedIndex property of a ListBox to -1 does not cause an error, can be done, and deselects any selected item, option E is not the correct answer as it erroneously includes options A and B.
The Answer is: C. de-select any selected item.