I have an application with many forms that have all specific methods such as Create, Modify, Save and in the main form I have a toolbar that should access these methods depending on the active form, at this moment I have it but in the application it is expected to have too many forms and to do them all this way or with a switch it would take me a lot of code:
foreach (Form form in Application.OpenForms) {
if (form.Name == ActiveForm.Name) {
Xformulario objformulario=(Xformulario) form;
objformulario.guardar();
break;
}
}