Solved

How to inform one form that another has ended...

Posted on 2003-11-19
3
317 Views
Last Modified: 2010-04-16
I have 2 forms:
form1, form2.

form1 creates a new instance of form2 in the standard way, I want form1 to perform a method when form2 closes, but how do I inform form1 that this has occured and to go ahead and start the method?

0
Comment
Question by:WinterMuteUK
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
astankovic earned 75 total points
ID: 9782888
This will do it:

   Form dlg = new Form();

   if (dlg.ShowDialog() == DialogResult.OK )
   {
        //call your method here
   }

0
 
LVL 9

Author Comment

by:WinterMuteUK
ID: 9783297
How do I return a 'DialogResult.OK' value?

Currently I have it set up:

01.  if (dlg.ShowDialog() == DialogResult.OK )
02.  {
03.      MessageBox.Show("Got Here (1)");
04.  }
05.  MessageBox.Show("Got Here (2)");

And if I place a break point on line 03 the code shows the form, and when I close the form (using this.Close();) it just skips to line 05.

Thanks again.

Me.
0
 
LVL 9

Author Comment

by:WinterMuteUK
ID: 9783351
Right,

Found it, if I set the DialogResult property of the buttons on the form!

Thanks for the help

Me.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

864 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now