I'm trying to write a simple tool(it contains only one class), but I stuck on threads. I dont know how to run thread with non-static method.
My code of windows form is something like that:
public partial class Form1 : Form
{
//--Some methods here--//
void login();
void start();
void refresh();
//--Button events--//
private void button1_Click()
{
//I want to start thread here
//Something like Thread t = new Thread(new ThreadStart(refresh));
//t.Start();
}
}
With timer this thread should call refresh() every x seconds, but timer isnt problem. I'm getting error with thread:
A field initializer cannot reference the non-static field, method, or property.