SimpleText Property 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 appears when the Style property is set to Simple. The control toggles between the Simple style and the Normal style. 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   ' Add 2 Panel objects.
   Next I

   With StatusBar1.Panels
      .Item(1).Style = sbrNum   ' Number lock
      .Item(2).Style = sbrCaps   ' Caps lock
      .Item(3).Style = sbrScrl   ' Scroll lock
   End With
End Sub

Private Sub StatusBar1_Click()
   ' Toggle between simple and normal style.
   With StatusBar1
      If .Style = 0 Then
         ' This text will be displayed when the StatusBar is in Simple style.
         .SimpleText = "Date and Time: " & Now
         .Style = sbrSimple   ' Simple style.
      Else
         .Style = sbrNormal   ' Normal style.
      End If
   End With
End Sub