.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> LINQ >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Checking the Opened forms and closing all the opened forms

Posted By:Santosh       Posted Date: October 06, 2010    Points: 15    Category: LINQ    URL: http://www.dotnetspark.com  

Checking all the Opened forms and closing all the opened forms
 

Below Code will help u to close all the opend forms under a mdi form in windows application
 and also u can check how many forms are opened...

Code:


Private Sub CloseAllForms_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseAllForms.Click
If (My.Application.OpenForms.Count - 1) > 0 Then
For i As Integer = 0 To My.Application.OpenForms.Count - 2
If My.Application.OpenForms.Count > 1 Then
My.Application.OpenForms.Item(My.Application.OpenForms.Count - 1).Close()
End If
Next
End If
End Sub




Regards
Santosh
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend