Solved

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

Posted on 2003-11-19
3
322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to identify a paragraph in the body of text? 2 79
C# Get Current Exchange Rate from XE 9 42
Load XML element 3 43
C#line chart with data on Y and time on X-axis 3 33
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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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