Access a method on a form

  • Thread starter Thread starter Merlynx
  • Start date Start date
M

Merlynx

I am currently trying to access a method in a form that modifies the
properties of controls on that form.
I can't instantiate the form otherwise i will get a duplicate. Is there a
way to do this?
 
Your question is not clear.. as I got it

private MyForm lobjFrm;

I think you can define the form object to be private as a global variable in
your class and in your method which you use to display the form you can do
some thing like

if (lobjFrm == null)
lobjFrm = new MyForm();

lobjFrm.Show();

if I assume that you need to access the method "myMethod()" to do the
property updating

lobjFrm.myMethod()

will do it

Nirosh.
 
Hi Merlynx,

What do you mean you get a duplicate?
I suppose the form is already instantiated, so you only need a reference
to it.
Is this a static property? Otherwise you will need an instance.
 
Back
Top