Hi,
I have a problem with my form application that when I close it (using cross in top right), the whole program crashes indefinately.
This has only recently become an issue when I introduced some invoke code for updating a label and picture box on my form
I have an event handler within the form class that fires every 10th of a second that I use to set a label and a picturebox on the form, using the code below.
public delegate void setlblCallback(string text);
class {
event handler {
lblFaces.Invoke(new setlblCallback(this.setlbl), new object[] { faces.Count.ToString() });
}
public void setlbl(String text)
{
lblFaces.Text = text;
}
}
I initially didn't use invoke but received a threading error when setting the label.
Now the problem is the form is crashing on exit after implementing the invokes. (if i set the picture box directly the form end correctly but then the label errors, hence catch 22)
This code below is run on form close, which stops a webcam stream in another class (using Aforge.Net framework) This stream is run on another thread hence why I think this may also be involved.
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
inputCam.stop();
}
Any ideas as to why this is happening would be appreciated or even how I could try and catch the exception when it happens ?
Thanks in advance
Tom