I know this sounds like a simple fix, but I've been at it for a few hours. This is my first attempt at multithreading, and I'm really at a loss as for what to do next.
Here is my code, and I'll just explain it briefly afterwards.
public static void Main(string[] args)
{
Thread tid1 = new Thread(new ThreadStart(LoadRemoveForm.formCreate.create));
Program @object = new Program();
Thread thread = new Thread(new ThreadStart(@object.Watch));
LoadRemoveForm RemovalForm = new LoadRemoveForm();
RemovalForm.Show();
thread.Start();
tid1.Start();
Program.game1.Run();
thread.Abort();
tid1.Abort();
}
So, I have two threads being created at the start of the program. One isn't relevant to this. The one that is, is the second one, just titled "thread".
If I create my form inside of Watch(), it crashes. I have to do it outside, however, when I create the form "RemovalForm", none of my threads can access it and do RemovalForm.listBox.Items.Add("blah blah");
I have been looking for different solutions online, but none have helped. Is it possible to pass the form into the thread, or something of the sort?