S
Safiiru no Baka
Here's my code (edited for clarity)
================================================================================
public Form1()
{
InitializeComponent();
notifyContentUpdated = new
contentUpdated(CallRefreshFields);
Thread myThread = new Thread(new
ThreadStart(MainWorkThread));
myThread.Start();
}
private void CallRefreshFields(bool dummyvariable)
{
this.Invoke(new EventHandler(RefreshFields));
}
private void RefreshFields(object sender, System.EventArgs e)
{
listBox1.Items.Clear();
listBox1.Items.Add("test");
}
================================================================================
notifyContentUpdated is a delegate as you might have guessed. I
subscribe to it to call CallRefreshFields which in turn "tries" to
Invoke RefreshFields. The error comes on the Invoke line, it gives me
the nullreference exception.
I'm at loss as to why, or what is exactly happening. Please help,
thanks.
================================================================================
public Form1()
{
InitializeComponent();
notifyContentUpdated = new
contentUpdated(CallRefreshFields);
Thread myThread = new Thread(new
ThreadStart(MainWorkThread));
myThread.Start();
}
private void CallRefreshFields(bool dummyvariable)
{
this.Invoke(new EventHandler(RefreshFields));
}
private void RefreshFields(object sender, System.EventArgs e)
{
listBox1.Items.Clear();
listBox1.Items.Add("test");
}
================================================================================
notifyContentUpdated is a delegate as you might have guessed. I
subscribe to it to call CallRefreshFields which in turn "tries" to
Invoke RefreshFields. The error comes on the Invoke line, it gives me
the nullreference exception.
I'm at loss as to why, or what is exactly happening. Please help,
thanks.