Skip to main content

Write a VB Program to create status bar and display it on onto the form. Status bar should have five panels to display any text, date, time, CAPS ON/OFF, Num ON/OFF.

· One min read
Kaustubh Kulkarni
file.vb
Private Declare Function GetKeyState Lib "user32" (ByValnVirtKey As Long) As Integer  
Private Sub Form_Load()
StatusBar1.Panels(1) = "HI"

StatusBar1.Panels(2) = Date
StatusBar1.Panels(3) = Time
End Sub

Private Sub Timer1_Timer()
If GetKeyState(vbKeyCapital) = 0 Then
StatusBar1.Panels(4) = "CAPS OFF"
Else
StatusBar1.Panels(4) = "CAPS ON"
End If
If GetKeyState(vbKeyNumlock) = 0 Then
StatusBar1.Panels(5) = "NUM LOCK OFF"
Else
StatusBar1.Panels(5) = "NUM LOCK ON"
End If

End Sub