Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 18th, 2007, 11:15 PM
Authorized User
 
Join Date: Oct 2003
Location: LAhore, Punjab, Pakistan.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to salman
Default Close all MdiChield form from open one form/Button

I've to Close all open MdiChield form from one form/button in VB.NET 2003 (FrameWork 1.0/2.0)
I'm using following ode. It neither gives error nor close any form

I've used Me.OwnedForms and Me.MdiChildren both but loop doesn't run more than one.

What's the reason or please tell be another code for this. Code must be run in FrameWork 1.0/2.0
Thanks.

        Dim f As Form
        ' For Each f In Me.OwnedForms
        For Each f In Me.MdiChildren
            f.Close()
        Next


Reply With Quote
  #2 (permalink)  
Old November 20th, 2007, 07:50 PM
Authorized User
 
Join Date: Nov 2004
Location: Pune, Maharashtra, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bharatsaboo Send a message via Yahoo to bharatsaboo
Default

hi salman

try the following code

        For xx = 1 To Me.MdiChildren.Length
            Me.MdiChildren(xx - 1).Close()
        Next

Regards

Bharat
Reply With Quote
  #3 (permalink)  
Old November 21st, 2007, 06:28 AM
Authorized User
 
Join Date: Oct 2003
Location: LAhore, Punjab, Pakistan.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to salman
Default

Dear Bharat
Thanks for your reply but

Me.MdiChildren.Length is giving 0 and loop never start
So nothing form colse for this

Reply With Quote
  #4 (permalink)  
Old November 22nd, 2007, 12:52 AM
Authorized User
 
Join Date: Nov 2004
Location: Pune, Maharashtra, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bharatsaboo Send a message via Yahoo to bharatsaboo
Default

hi salman

are you setting the mdiparent property of the form to the parent form

i think you are forgetting that hence me.mdichildren.length is returning 0
Reply With Quote
  #5 (permalink)  
Old November 23rd, 2007, 04:22 AM
Authorized User
 
Join Date: Oct 2003
Location: LAhore, Punjab, Pakistan.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to salman
Default

hi Bharat!

I have did IsMdiContainer=true for main forms and all other forms have IsMdiContainer=false as default
but me.mdichildren.length is returning 0


Reply With Quote
  #6 (permalink)  
Old November 23rd, 2007, 07:14 AM
Authorized User
 
Join Date: Nov 2004
Location: Pune, Maharashtra, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bharatsaboo Send a message via Yahoo to bharatsaboo
Default

hi salman

you got me wrong

for the child form you have to set the parent form as below

childForm.mdiParent = mdiForm

Regards

Bharat
Reply With Quote
  #7 (permalink)  
Old December 10th, 2007, 02:21 AM
Authorized User
 
Join Date: Oct 2003
Location: LAhore, Punjab, Pakistan.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to salman
Default

Hi Bharat!
Thanks for your interest to solve my problem but
I only did IsMdiContainer=true for main form (MdiMain) and all other forms have IsMdiContainer=false as they default.
I've made a little example of my broblem ( One MDI and some blank forms) in VB.NET and mailed to you on your id

bharatsaboo@hotmail.com

Pease see it and reply me after correct. or tell me my mistake
Thanks in advance
My Email is ahmadsalmanpk@yahoo.com


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Close all MdiChield form from open one form salman .NET Framework 1.x 0 November 7th, 2007 11:32 PM
how to open a new VB 2005 form from a button? asimzeeshan Visual Basic 2005 Basics 4 August 20th, 2006 11:25 AM
disable close button in mdi form nkramanmca VB How-To 4 January 5th, 2005 11:31 PM
how to disable a close button on VB form chanti VB How-To 2 September 30th, 2004 06:21 AM
Get rid of the close button on a form Piblon Excel VBA 6 June 30th, 2004 02:15 AM



All times are GMT -4. The time now is 10:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.