| | |
MDI Issues
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
I have two Issue using a MDI app.
1-at this moment I'm able to open MDI child forms using the MDIparent
except when the I opens form1 I'm also able to open forms 2
and 3 .
but I only want one form to be open at a time.
2- The next issue is I have form 2 to be opened from form1 and I would like to close form2 and form1 when click close on form2. At this moment I have to close form2 then click close on form1.
Thank you
code for Q1 This is the code on the MDIparent to open the forms.
Q2 here is he code I tried to close form2 and form1.
1-at this moment I'm able to open MDI child forms using the MDIparent
except when the I opens form1 I'm also able to open forms 2
and 3 .
but I only want one form to be open at a time.
2- The next issue is I have form 2 to be opened from form1 and I would like to close form2 and form1 when click close on form2. At this moment I have to close form2 then click close on form1.
Thank you
code for Q1 This is the code on the MDIparent to open the forms.
VB.NET Syntax (Toggle Plain Text)
Public Sub tbbCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbbCustomer.Click Dim CustomerMDIChild As New CustumerRprt() CustomerMDIChild.MdiParent = Me CustomerMDIChild.Show() CustomerMDIChild.Location = New Point(Me.Width / 2 - CustomerMDIChild.Width / 2, Me.Height / 2 - CustomerMDIChild.Height / 2) End Sub
Q2 here is he code I tried to close form2 and form1.
VB.NET Syntax (Toggle Plain Text)
Public Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click If m_ID = 0 Then Me.Close() Else CustumerRprt.Close() Me.Close() End If End Sub
use a loop that will check the mdichild's forms then close them and then open the form you wanted to open...
VB.NET Syntax (Toggle Plain Text)
For Each frm As Form In Me.MdiChildren frm.Close() Next Dim frm1 As Form1 frm1.Show
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
Thanks Jireh and samir_ibrahim for your replies.
The first Issue has been solved.
I still need more help with the second Issue.
This is the coed I used to open form1.
This coed opens form2.
How can I close form2 and form1 by just closing form2
The first Issue has been solved.
I still need more help with the second Issue.
This is the coed I used to open form1.
VB.NET Syntax (Toggle Plain Text)
For Each Form In Me.MdiChildren Form.Close() Next Dim CustomerMDIChild As New CustumerRprt() CustomerMDIChild.MdiParent = Me CustomerMDIChild.Show()
VB.NET Syntax (Toggle Plain Text)
Design_Report.Show()
•
•
Join Date: Oct 2008
Posts: 26
Reputation:
Solved Threads: 1
For Q2:
In form2, use the FormClosing event to close form1, then form2 will close after.
-Zander
In form2, use the FormClosing event to close form1, then form2 will close after.
VB.NET Syntax (Toggle Plain Text)
Private Sub Form2_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing Form1.close End Sub
-Zander
Last edited by Zandermander; May 26th, 2009 at 5:21 pm.
•
•
•
•
I have tried your code but I'm still unsuccessful. Still can't close form1. form2 closes but not form1.
When I click the Close button it jumps to the closing sub (your code)
but does not close form 1.
Help
VB.NET Syntax (Toggle Plain Text)
'in form2.button_click Me.Close() Form1.Close()
•
•
Join Date: Oct 2008
Posts: 26
Reputation:
Solved Threads: 1
Ok.. well try form1.hide maybe.. it doesn't "close it" but it should make it non visable.. can't test it right not.. on my phone when I get to my computer ill try some more things... though im not sure why form1.close won't work...
maybe use the code
but switch form1.close and me.close
sorry if there are errors in this post. once again.. on my phone.
-Zander
maybe use the code
VB.NET Syntax (Toggle Plain Text)
form2.button_click Me.Close() Form1.Close()
but switch form1.close and me.close
sorry if there are errors in this post. once again.. on my phone.
-Zander
![]() |
Similar Threads
- ASP.NET and Mozilla - Issues! (ASP.NET)
- Counter issues (C)
- Redhat Enterprise and iowait issues (*nix Software)
- SuSE 9.1 - Minor issues (*nix Software)
- Error messages, Taskbar changes in XP + USB connectivity issues. (Windows NT / 2000 / XP)
- Login issues (Web Browsers)
- Mail apps issues - error port 25 (Mac Software)
- Security Issues (*nix Software)
- Scrolling MDI Child form (Visual Basic 4 / 5 / 6)
- Graphics Card issues Stop Command??? (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: WeBrowser1 - blank after 2nd click
- Next Thread: How to load images in win form
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons c# center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel file-dialog firewall folder ftp google hardcopy image images inline insert listview login math mobile ms navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print problemwithinstallation project reports" save savedialog searchbox serial server soap sql string table tcp text textbox timer toolbox trim update updown upload useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio web wpf





