Status Bar In vb.net - Vb.net

How to create a simple status bar in vb.net

Snippet Code


  
Rate this page :
  [ 0 votes]

A statusbar control is said to be the combination of status panel and the each separate panel is used to display different information. If you are using visual studio 2010 then there must be status strip which replaces the stastusbar. Here, the sample code to create statusbar in vb.net is given below.

Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load CreateDynamicStatusBar() End Sub Dim mainStatusBar As New StatusBar() Dim statusPanel As New StatusBarPanel() Dim datetimePanel As New StatusBarPanel() Private Sub CreateDynamicStatusBar() statusPanel.BorderStyle = StatusBarPanelBorderStyle.Sunken statusPanel.Text = "Application started. No action performed." statusPanel.ToolTipText = "Last Activity" statusPanel.AutoSize = StatusBarPanelAutoSize.Spring mainStatusBar.Panels.Add(statusPanel) datetimePanel.BorderStyle = StatusBarPanelBorderStyle.Raised datetimePanel.ToolTipText = "DateTime: " + System.DateTime.Today.ToString() datetimePanel.Text = System.DateTime.Today.ToLongDateString() datetimePanel.AutoSize = StatusBarPanelAutoSize.Contents mainStatusBar.Panels.Add(datetimePanel) mainStatusBar.ShowPanels = True Controls.Add(mainStatusBar) End Sub Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click statusPanel.Text = "Button Click Action Performed" End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles TextBox1.TextChanged statusPanel.Text = "TextBox Action Performed." End Sub End Class

Tags


Ask Questions

Ask Question