Forum guidelines
Main forme menu save
Posted By Pieter Twentyeight on 16 Dec 2012
Hi all,

I've searched for it and cant find the answer.

I have a win form application. In the main form, I have a save button.

Now I have a save in the file menu and when I click it I want it the following to do:

Determine the active form in the mainform.
Search on that form for the save button and perform the actions the save button click event does.

Kind regards guys.

I hope someone can help me

Mayur Dighe
  • 0
  • 0
Re: Main forme menu save
Posted By Mayur Dighe on 19 Dec 2012   Accepted Answer
Hey Pieter.....

        you can do this....just try to follow the steps below..

        1. if your "mainform" is MDIForm or normal Windows Form...then
                by invoking Application.OpenForms() method you able to find the name of ACTIVE FORM.

        2. Next you want to do some actions with control available on that form, then
                 you need to use any looping technique (like FOR, Do While...) you can list the Controls on that form with their names by calling Controls() method to enumerate controls.

My Blog : http://ImmortalDotNet.BlogSpot.Com http://ImmortalDotNet.WordPress.Com
C# Corner Annual Conference 2016


Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.