Value Property (ActiveX Controls) Example

This example uses the Value property to determine which icon from an associated ImageList control is displayed on the Toolbar control. To try the example, place a Toolbar control on a form and paste the code into the form's Declarations section. Then run the example.

Private Sub Toolbar1_ButtonClick(ByVal Button As Button)
   ' Use the Key value to determine which button has been clicked.
   Select Case Button.Key

   Case "Done"   ' A check button.
      If Button.Value = vbUnchecked Then   
         ' The button is unchecked.
         Button.Value = vbChecked   ' Check the button.
         ' Assuming there is a ListImage object with 
         ' key "down."
         Button.Image = "down"
      Else   ' Uncheck the button
         Button.Value = vbUnchecked   
         ' Assuming there is a ListImage object with 
         ' key " up."
         Button.Image = "up"
      End If

   ' More Cases are possible.
   End Select
End Sub