ARTICLE

Working with StatusBars in VB.NET

Posted by Mahesh Chand Articles | Visual Basic 2010 June 24, 2003
A status bar control is used to display the status of your applications functionality. You can add as many as panels to a status bar as you want and use these panels to display different type of information.
Download Files:
 
Reader Level:

Description.

A status bar control is used to display the status of your applications functionality. You can add as many as panels to a status bar as you want and use these panels to display different type of information.

StatusBar class is used to create status bars and StatusBarPanel class is used to panels.

Me.statusBar1 = New System.Windows.Forms.StatusBar()
Dim pnl1 As New StatusBarPanel()
Dim pnl2 As New StatusBarPanel()

You add panels to the status bar by calling StatusBar.Panels.AddRange.

statusBar1.Panels.AddRange( new StatusBarPanel[] {pnl1, pnl2});

Setting Image In the Panel

You use Icon class to insert an image in the panel control. You set Icon property of a panel as Icon class.

Dim icon As New Icon("c:\mouse.ico")
pnl1.Icon = icon

Source Code:

Me.statusBar1 = New System.Windows.Forms.StatusBar()
statusBar1.ShowPanels =
True
Me
.statusBar1.Location = New System.Drawing.Point(0, 253)
Me.statusBar1.Name = "statusBar1"
Me.statusBar1.Size = New System.Drawing.Size(292, 20)
Me.statusBar1.TabIndex = 0
Me.statusBar1.Text = "statusBar1"
Dim pnl1 As New StatusBarPanel()
Dim pnl2 As New StatusBarPanel()
pnl1.Text = "Panel 1"
pnl1.Width = 32
pnl1.AutoSize = StatusBarPanelAutoSize.Spring
Dim icon As New Icon("c:\mouse.ico")
pnl1.Icon = icon
pnl2.Text = DateTime.Now.ToString()
statusBar1.Panels.AddRange(
New StatusBarPanel() {pnl1, pnl2})

share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor