Visual Basic: Windows Controls

Style Property (StatusBar Control) Example

This example adds two Panel objects to a StatusBar control that appear in Normal style, and then adds a string (using the SimpleText property) that will appear when the Style property is set to Simple. The control toggles between the Simple style and the Normal style to show the SimpleText property string. To try the example, place a StatusBar control on a form and paste the code into the Declarations section of the form. Run the example and click on the StatusBar control.

  Private Sub Form_Load()
   Dim I As Integer
   For I = 1 to 2
      StatusBar1.Panels.Add
   Next I
   With StatusBar1.Panels
      .Item(1).Style = sbrDate   ' Date
      .Item(2).Style = sbrCaps   ' Caps lock
      .Item(3).Style = sbrScrl   ' Scroll lock
   End With
   
End Sub

Private Sub StatusBar1_Click()
   With StatusBar1
      If .Style = sbrNormal Then
         .SimpleText = Time   ' Show the time.
         .Style = sbrSimple   ' Simple style
      Else
         .Style = sbrNormal   ' Normal style
      End If
   End With
End Sub