Quest: Accessing parent form's public data member...

  • Thread starter Thread starter lewi
  • Start date Start date
L

lewi

How do I access data members of a parent form class and from a function of a
child form class. Both classes are both in the same name space and are
public classes...

The child form is a Modal dialog and should setup some of these data members
and validate them before OK button handler lets the dialog be dismissed by
this dlg closing prevention code...

//access and validate data members...

if(!SomeFalseCondition)
DialogResult = DialogResult.None;
else
;//DialogResult is reset back to DialogResult.OK somewhere(anyone know)
so this else statement is not needed here...

Any help...
 
How do I access data members of a parent form class and from a function of a
child form class. Both classes are both in the same name space and are
public classes...

The child form is a Modal dialog and should setup some of these data members
and validate them before OK button handler lets the dialog be dismissed by
this dlg closing prevention code...

//access and validate data members...

if(!SomeFalseCondition)
DialogResult = DialogResult.None;
else
;//DialogResult is reset back to DialogResult.OK somewhere(anyone know)
so this else statement is not needed here...

Any help...

You need to change the access modifiers on the controls/fields you want to
access in that form to public (they are either private/protected).
 
You need to change the access modifiers on the controls/fields you want to
access in that form to public (they are either private/protected).
Everything is public for the things I want to access the main form class and
the member varible I want...

Now I decide to stop using the child forms cause I lay them out a week ago
and have just been coding with the main form(which it's layout has change)
and there is alright to megered them together. So my current problem is
solved but for future use of a child form I would like to continue on with
quest has I discuss. Also I still have a backup for the project before
megering...

Any more help...
 
Back
Top