how to access a child form's variable in parent form

Hi,

   I am instantiating a form like this.Is it possible to assign a value to a variable like the below code.

insertok is a var declared in the select form.

select frm = new Select(this);

frm.showdialog();

frm.insertok=1; or

int i =frm.insertok;

 theabove code is not working for me.

venp--




Answer this question

how to access a child form's variable in parent form

  • Rama Nagesh

    Make sure you declare it public. If insertok is a control, set its Modifiers property to Public.


  • Colin Reid

    Whet it's not working, do you mean it's giving you a compiler error or that it's not behaving as you expect it should be

  • how to access a child form's variable in parent form