Which of the following selects the Cat item, which appears third in the cboAnimal control?

cboAnimal.Selected = 2

The correct answer is A. cboAnimal.Selected = 2.

Option B, cboAnimal.Selected = “Cat”, will select the item with the text “Cat”, regardless of its position in the list. Option C, cboAnimal.Text = “Cat”, will set the text of the control to “Cat”, but will not select any item. Option D, cboAnimal.SelectedIndex=”Cat”, will select the item with the index “Cat”, but this index is not guaranteed to correspond to the item with the text “Cat”.

To select the third item in the list, you need to set the SelectedIndex property to 2.

Exit mobile version