Click here to Skip to main content
15,887,434 members
Home / Discussions / C#
   

C#

 
GeneralRe: How To Load App Setting From Registry ? Pin
hdv21212-Feb-06 2:25
hdv21212-Feb-06 2:25 
GeneralRe: How To Load App Setting From Registry ? Pin
Wayne Phipps12-Feb-06 3:27
Wayne Phipps12-Feb-06 3:27 
Questiondatagrid Pin
Gamil Mohamad12-Feb-06 1:02
Gamil Mohamad12-Feb-06 1:02 
QuestionPrinting question Pin
Timothy_198211-Feb-06 23:06
Timothy_198211-Feb-06 23:06 
Questionexecuting function in Parent FORM from Child FORM Pin
emran83411-Feb-06 21:52
emran83411-Feb-06 21:52 
AnswerRe: executing function in Parent FORM from Child FORM Pin
nta13711-Feb-06 22:16
nta13711-Feb-06 22:16 
GeneralRe: executing function in Parent FORM from Child FORM Pin
emran83412-Feb-06 0:00
emran83412-Feb-06 0:00 
GeneralRe: executing function in Parent FORM from Child FORM Pin
Josh Smith12-Feb-06 12:17
Josh Smith12-Feb-06 12:17 
Make sure that when the parent form creates the child form, it sets the child form's Owner property to 'this' (this parent form instance).
// MainForm creates child form and sets the Owner.
ChildForm childForm = new ChildForm();
childForm.Owner = this;
childForm.Show();

Then in the child form you simply cast the Owner property to a MainForm and call your method.
// ChildForm casts Owner to MainForm and calls method.
MainForm parent = this.Owner as MainForm;
parent.SomeMethod();

The problem with your initial code sample is that it creates a new instance of MainForm, which is not the same instance as the actual parent form.

Josh
GeneralRe: executing function in Parent FORM from Child FORM Pin
emran83413-Feb-06 8:26
emran83413-Feb-06 8:26 
GeneralRe: Working Excellent.... Pin
emran83413-Feb-06 12:34
emran83413-Feb-06 12:34 
AnswerRe: executing function in Parent FORM from Child FORM Pin
Colin Angus Mackay12-Feb-06 1:38
Colin Angus Mackay12-Feb-06 1:38 
GeneralRe: executing function in Parent FORM from Child FORM Pin
S. Senthil Kumar12-Feb-06 14:00
S. Senthil Kumar12-Feb-06 14:00 
GeneralRe: executing function in Parent FORM from Child FORM Pin
Colin Angus Mackay13-Feb-06 8:32
Colin Angus Mackay13-Feb-06 8:32 
GeneralRe: executing function in Parent FORM from Child FORM Pin
emran83413-Feb-06 8:23
emran83413-Feb-06 8:23 
GeneralRe: executing function in Parent FORM from Child FORM Pin
Colin Angus Mackay13-Feb-06 8:35
Colin Angus Mackay13-Feb-06 8:35 
QuestionMultiple Colored ProgressBar Pin
suchiate11-Feb-06 21:33
suchiate11-Feb-06 21:33 
AnswerRe: Multiple Colored ProgressBar Pin
Robert Rohde11-Feb-06 22:39
Robert Rohde11-Feb-06 22:39 
GeneralRe: Multiple Colored ProgressBar Pin
suchiate11-Feb-06 22:43
suchiate11-Feb-06 22:43 
GeneralRe: Multiple Colored ProgressBar Pin
Dario Solera11-Feb-06 23:42
Dario Solera11-Feb-06 23:42 
GeneralRe: Multiple Colored ProgressBar Pin
suchiate11-Feb-06 23:46
suchiate11-Feb-06 23:46 
GeneralRe: Multiple Colored ProgressBar Pin
User 665811-Feb-06 23:59
User 665811-Feb-06 23:59 
GeneralRe: Multiple Colored ProgressBar Pin
suchiate12-Feb-06 0:11
suchiate12-Feb-06 0:11 
QuestionDataList Control in Windows Forms Pin
Adel Khayata11-Feb-06 20:47
Adel Khayata11-Feb-06 20:47 
QuestionDNS .Resolve & .NET 2.0 Headache?? Pin
gman4411-Feb-06 18:24
gman4411-Feb-06 18:24 
Questionhow to know where next Location is ? Pin
CiNN11-Feb-06 14:47
CiNN11-Feb-06 14:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.