0

It seems to me more a logic issue than a specific language issue.

Your background thread would need to invoke the main thread to update and draw. Any secondary thread must not update the UI as it can/will cause locks.

0

It seems to me more a logic issue than a specific language issue.

Your background thread would need to invoke the main thread to update and draw. Any secondary thread must not update the UI as it can/will cause locks.

OK!!!

The function that does the update is in the Form2 class.

In it i have a:
public void Update()
{
lock(locker)
{
}
}

the both BGW's are callin it each to update his child form with collected data.

Do i need to put the update() function somwhere else and where or i can leave it in Form2 class.And should i remove the call of update from the BGW's and put the call in the mainForm button click event so the update and draw of the form is on button click event.

I'm not sure if i understood it good so please explaine your comment!!!!

thanks!!!

0

Well to be honest i read a bunch of articles on that matter

Did i said something stupid???

:)

0

As I said earlier this is my first Application i don't have any experience with it so one thing is to read an article and the other is to have made.I have a lack of experience

0

The article I posted was about background threads, and updating the UI and how to go about it, the rules and gotchas of the whole event.

If you're calling an update of your form from within your thread, and the work is done from the thread - not the main UI thread then, you can/will get issues of locking up - wether you use locks or not.

0

I have managed to solve the problem thanks to you.Well the problem was in my event which is in charge for updating of the child form as you have told me.All i did i put a new event BGW report progress event which is now calling the MyEvent function in Form2 class which is in charge for updating of child form!!!

Thanks for helping me with my problem!!!

P.S. despite i have solved my problem i would still like to read your article but i still can't find it so if you could mail it to me i would appreciate it.!!!

0

Just google c# threads and look for msdn

Please dont forget to mark your issue solved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.