Invoke a form method from a class

  • Thread starter Thread starter Mel
  • Start date Start date
M

Mel

I am in my class and I want to invoke a method on my
form. I made my form method public. But I don't see it
through intellisensing.

Any ideas?
 
I am in my class and I want to invoke a method on my
form. I made my form method public. But I don't see it
through intellisensing.

Any ideas?

If you make the method public static you can access it through
namespace.formname.method() otherwise you need an instance of the form.
If you create the class from the form, send 'this' as a parameter and have
the class store it for later use

private FormClass parent;

public Class(FormClass sender)
{
parent = sender;
}

then use parent.method() when you need to.
 
Back
Top