Solved

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

Posted on 2003-11-19
3
319 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

815 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

12 Experts available now in Live!

Get 1:1 Help Now