Click here to Skip to main content
15,898,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey.

I got a kind of big program, that runs in a main loop and call a hell of different functions. It does include downloading webpages, and such. Problem is as it is right now the user dont have the possibility to click around the rest of the program while it is loading a site, since it is doing the "freezing" while its working.

Now I have rewrote the whole program so I can read/set textboxes etc through a backgroundthread,
but here the problems comes.

If the program etc. loads a site, and I start click around the program while it is loading the site, it aint finishing the function completely, so the site aint loaded completely.
Aint there anyway I can avoid this?
Posted

ain't is not a word.

You can avoid it by fixing your code. You should have a background thread loading the site, which continues until it is done. If your code is stopping that, then you need to fix it, and we can't tell you how without seeing code.
 
Share this answer
 
And I am not from a english speaking country, I am sorry for that!

I will see if I can do it that way. But it is still strange it stops the process (etc stops loading the homepage) if I just take away the focus from the application.
 
Share this answer
 
Comments
Christian Graus 31-Aug-10 16:42pm    
You should not push 'answer' to ask questions. I'm sorry, I could tell you were not an English speaker, and your English in general was fine, but you should avoid slang, to be better understood. If you're still stuck, post some code and a specific question, and we will try to help. There's just not much we can do based on what you posted already
Member 4417892 31-Aug-10 16:49pm    
Oh, didn't see this comment button at all. Well I dont think you would get much information if I posted the whole code, but I can do a little snippet of where I call my backgroundworker.

void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
initScript();
}

And then my button function from where it is called.

private void button1_Click(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
}

From initScript(), it calls other functions, and it keeps so on..
Is it even possibly to make a backgroundworker work that way ?
Member 4417892 31-Aug-10 16:54pm    
And I use functions like this to call my TextBoxes, ComboBoxes and so on from the application,
private TextBox textbox(TextBox name)
{
TextBox ret = null;
name.Invoke((ThreadStart)delegate()
{
ret = name;
});
return ret;
}
Im doing it that way because its a cross thread. I maybe think it is in that function there is something wrong since it almost get all it variables through these functions.
Toli Cuturicu 31-Aug-10 17:10pm    
Reason for my vote of 1
fake answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900