Windows Application Form

I have a user control called 'ucForm', this 'ucForm' have a button to pop out a windows called 'pForm', I want to code it like this, when I press the 'Next' button it will close the 'pForm' and pass the textbox value in 'pForm' to 'ucForm' textbox. What code should I do in the button_click in 'pForm' and what event and method should used to detect the closing of the 'pForm' and perform passing value. Thanks

Note: I am using .net framework 2.0 and form_closing is oboslete in that.
Source: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.closing.aspx

Recommended Answers

All 2 Replies

If you use the ShowDialog method, the execution stops until the form is closed.
Take a look at this thread.

What I actually did is

private void btnContinue_Click(object sender, EventArgs e)
{
    this.Dispose();
}

and on my ucForm I check if the pForm.IsDispose() then pass the parameter.

This actually works for my case.
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.