common save button in mdi form..

Posted by Gopal_nivas under C# on 10/10/2009 | Views : 2743 | Status : [Member] | Replies : 4
hi..

i have multiple child windows, and a common MDI window with save button, if i click save, it should save the data in the active form.

give some examples for that..

need ur suggestions..

regards
gopal.s




Responses

Posted by: Vuyiswamb on: 10/12/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
What is your Problem ?

Thank you for posting at Dotnetfunda
[Administrator]

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tridev_2005 on: 10/12/2009 [Member] Starter

Up
0
Down
1) Implement a common interface for all the forms,

interface IDataEntry
{
bool Save()
}
And implement the save functionality in all the forms.
2) Get the current form, may be active child.
3) Assign it to IDataEntry

like
IDataEntry dataEntry = MyMDI.ActiveForm;
dataEntry.Save() //It will save the data.


Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bubbly on: 10/30/2009 [Member] Bronze

Up
0
Down
Hello,

You can check for active form and based on that save values.

++
Thanks & Regards,
Deepika

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Danishgr8 on: 12/22/2009 [Member] Starter

Up
0
Down
After Implementing the interface,
use this code:
Type Type t=Type.GetType("FormClassName");
form=Activator.CreateInstance(t);


where form is a Form Object.



Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response