I’m getting an out of memory issue in my main form on Visual Studio and I don’t know why, I need to put a progress bar while my program is initializing, it works fine with other forms of my program, but not in the main form, it throws me an out of memory error
Here is the main form code:
public MainForm()
{
checkinstance();
ProgressDialog progressDialog = new ProgressDialog();
Thread backgroundThread = new Thread(
new ThreadStart(() =>
{
progressDialog.SetIndeterminate(true);
InitializeComponent();
progressDialog.BeginInvoke(new Action(() => progressDialog.Close()));
}
));
backgroundThread.Start();
progressDialog.ShowDialog();
}
ProgressDialog is a form with a progress bar,
Thanks.
Thanks everyone, i ended up using a BackGroundWorker and ProgressBar inside handlers, for those who can have the same problem these are great articles
http://mycodelog.com/2010/02/11/busy/
[http://www.dotnetperls.com/progressbar]
http://theraneman.blogspot.com.br/2011/02/did-you-wish-backgroundworker-had.html (specially here)