Solved

Remove a ToolStripStatusLabel when a form is closed

Posted on 2009-04-10
4
463 Views
Last Modified: 2012-05-06
During run time, ToolStripStatusLabels are added to my MDI parent statusstrip.
These labels display child forms that are currently open.
When the user closes one of the child forms, I need to remove the label associated with the form.  
There may be multiple instances of a form, but each form has a unique number appended to it's name and text properties.
How do I delete the ToolStripStatusLabel?
Please provide a code example. My IE crashes when I click on links.
Thanks
0
Comment
Question by:Sheritlw
  • 2
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
Comment Utility
Hi,
 
On the Form FormClosing event you can do this:

        ' In this example Form1 is the MDI form

        For Each t As ToolStripLabel In My.Forms.Form1.StatusStrip1.Items

            If t.Text = Me.Text Then

                My.Forms.Form1.StatusStrip1.Items.Remove(t)

                Exit For

            End If

        Next

Open in new window

0
 

Author Comment

by:Sheritlw
Comment Utility
Hi jpaulino,

I was hoping you would respond to this question.
I did figure out how to remove labels when a user closes a form.  
I added at form level the ts declaration.  
I also changed the name of the form in the load event to make sure that it closed the right instance.
me.name = me.name & x  
an public variable that numbers forms of the same type.
It works great!

I learned a lot about .Net with your help.  I now know about handlers.

Thank you so much for all your help... You are great!!!

Sheri
0
 

Author Closing Comment

by:Sheritlw
Comment Utility
Excellent!!!!!
0
 
LVL 48

Expert Comment

by:jpaulino
Comment Utility
Glad I could help and good luck with your learning process
jpaulino
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now