473,385 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to open a form From a closing One

I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2
MyNewForm.MDIParent=frmMDI ?
MyNewForm.Show
me.close
End Sub

This will not work because when the form closes it destroys MyNewForm

Thanks
Nov 21 '05 #1
5 1077
Hi,

You're close - the trick is to call me close AFTER calling the other child,
assigning the parent BEFORE doing so:
dim MyNewForm as New Form2
MyNewForm.MDIParent = me.parent
MyNewForm.Show
me.close

HTH,

Bernie Yaeger
"TCORDON" <tc******@hotmail.com> wrote in message
news:OG****************@TK2MSFTNGP11.phx.gbl...
I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2
MyNewForm.MDIParent=frmMDI ?
MyNewForm.Show
me.close
End Sub

This will not work because when the form closes it destroys MyNewForm

Thanks

Nov 21 '05 #2

Have the child call a public method in the parent to trigger the new
form or (better) have the parent listent to the child's closing method
and act by itself...

Sam
On Fri, 21 Jan 2005 12:22:27 -0600, "TCORDON" <tc******@hotmail.com>
wrote:
I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2
MyNewForm.MDIParent=frmMDI ?
MyNewForm.Show
me.close
End Sub

This will not work because when the form closes it destroys MyNewForm

Thanks


Nov 21 '05 #3
Hi,

Actually, do the me.close immediately before the mynewform.show:
Sub Button1_Click()
dim MyNewForm as New Form2
MyNewForm.MDIParent = me.parent
me.close
MyNewForm.Show
End Sub

Bernie

"TCORDON" <tc******@hotmail.com> wrote in message
news:OG****************@TK2MSFTNGP11.phx.gbl...
I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2
MyNewForm.MDIParent=frmMDI ?
MyNewForm.Show
me.close
End Sub

This will not work because when the form closes it destroys MyNewForm

Thanks

Nov 21 '05 #4
"TCORDON" <tc******@hotmail.com> schrieb:
I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2
\\\
MyNewForm.MdiParent = Me.MdiParent
///
MyNewForm.Show
me.close
End Sub


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5
Thank you

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
"TCORDON" <tc******@hotmail.com> schrieb:
I have an MDI application, I need to open an MDIChild whern another one
closes. How should I handle this. How do I assign the parent form?

If I use:

Sub Button1_Click()
dim MyNewForm as New Form2


\\\
MyNewForm.MdiParent = Me.MdiParent
///
MyNewForm.Show
me.close
End Sub


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Julia Baresch | last post by:
Hi everyone, As some of you may know, we've been having trouble with an unrecognized database format error. Today I installed an unfinished project on the workstation of one of my users. ...
7
by: Shivalee Gupta via AccessMonster.com | last post by:
i am working on access 2000. can i write a code which will tell me, at the time of closing the database, that at what time i had opened the database and at what time i am closing it? i am in a...
2
by: John | last post by:
Hi I am opening a dialog using; frmdialog = New frmdialognew frmdialog.ShowDialog() Is there a way to see if this dialog is already open to avoid opening multiple instances of it?
3
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it....
4
by: rdemyan | last post by:
I'm using code from the following web page to open the API Browse Folder dialog http://www.mvps.org/access/api/api0002.htm It all works fine. But if the dialog box is open and the user closes...
5
by: tara99 | last post by:
I have forms which changes it size when I open it, close it, go to another form via button from existing form and come back to it when i close the new open form. I don't have any code behind...
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
2
by: Luqman | last post by:
How can I open another WebForm in ASP.Net / VS 2005 without closing the Current Webform. I tried using Server.Transfer("Form2.Aspx",True) on Button_Click of Form1 but it close the current web...
19
by: =?Utf-8?B?R3JlZw==?= | last post by:
How can I tell via code if a Form is already open. Each time my forms load I have some initialization code that runs, but if the form is already open and hidden I don't want that initialization...
2
by: KA NMC | last post by:
Current application is built in VB.net 2005 what it does is open other small applications within the form. I'm not using mdi I probably should. Here is my problem The application load - main...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.