Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remove a ToolStripStatusLabel when a form is closed

Posted on 2009-04-10
4
Medium Priority
?
493 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 24122197
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
ID: 24124451
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
ID: 31569138
Excellent!!!!!
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24124907
Glad I could help and good luck with your learning process
jpaulino
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 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