Share via


Visual Basic Reference

Load Event Example

This example loads items into a ComboBox control when a form is loaded. To try this example, paste the code into the Declarations section of a form that contains a ComboBox, and then press F5.

  Private Sub Form_Load ()
   Combo1.AddItem "Mozart"      ' Add items to list.
   Combo1.AddItem "Beethoven"
   Combo1.AddItem "Rock 'n Roll"
   Combo1.AddItem "Reggae"
   Combo1.ListIndex = 2         ' Set default selection.
End Sub