My problem is simply that my SQL query takes over 2 minutes to complete and I can't have my application freezing up while it tries to get all that data. I've tried multi-threading but I keep running into an error that I am pretty sure you'll recognize. My code is under that.
Cross-thread operation not valid: Control 'labelEdit1' accessed from a thread other than the thread it was created on.
private void Form_Load(object sender, EventArgs e)
{
startup = new Thread(loadInThread);
startup.Start();
}
private void loadInThread()
{
//getsDataFromSQL() is the method that takes over 2 minutes to do
//it returns a String Array if that is helpful
comboEdit1.Properties.Items.AddRange(getsDataFromSQL());
startup.Abort();
}
If there are better ways to do this then please let me know, all I need is for the application to not freeze up and the data to get loaded into the comboEdit. Also I know the SQL statements could be optimized but that's not what this question is about, so please don't suggest it,.