Problem solve Get help with specific problems with your technologies, process and projects.

How can I catch a value from one form to another before the form closes?

I have two Windows forms opened in a mainform as mdichildren. In Form A, I have a listbox with numbers. In Form B, I want to catch the selected item of the listbox (from form A) when the user pushes a button and then closes form A. The question is, how can I catch a value from one form to another before the form is closed?
Unfortunately, you can't handle an event from one form on another form. What you'll want to do is handle the Close event on Form A and manually tell Form B about the selected item.
This was last published in May 2003

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.