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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top