943,824 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 3608
  • C# RSS
You are currently viewing page 4 of this multi-page discussion thread; Jump to the first page
Dec 10th, 2008
0

Re: openin more forms C#

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.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Dec 10th, 2008
0

Re: openin more forms C#

Click to Expand / Collapse  Quote originally posted by LizR ...
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!!!
Reputation Points: 10
Solved Threads: 0
Light Poster
nikola.rosic is offline Offline
27 posts
since Jul 2008
Dec 10th, 2008
0

Re: openin more forms C#

Did you read the thing on threads?
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Dec 10th, 2008
0

Re: openin more forms C#

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

Did i said something stupid???

Reputation Points: 10
Solved Threads: 0
Light Poster
nikola.rosic is offline Offline
27 posts
since Jul 2008
Dec 10th, 2008
0

Re: openin more forms C#

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
Reputation Points: 10
Solved Threads: 0
Light Poster
nikola.rosic is offline Offline
27 posts
since Jul 2008
Dec 10th, 2008
0

Re: openin more forms C#

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.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Dec 10th, 2008
0

Re: openin more forms C#

Click to Expand / Collapse  Quote originally posted by LizR ...
ms-help://MS.VSCC.v90/MS.msdnexpress.v90.en/dv_csref/html/656da1a4-707e-4ef6-9c6e-6d13b646af42.htm

Well if you think that this is your article on this link i tried to open it but i have opened some stuff on chinese or something like that and that's a problem because my chinese is not so good

If you could send me on mail: nikola.rosic6@gmail.com

Thanks

I have also tried to open it over the MS help and from the web.
Reputation Points: 10
Solved Threads: 0
Light Poster
nikola.rosic is offline Offline
27 posts
since Jul 2008
Dec 10th, 2008
0

Re: openin more forms C#

Odd, it should give you a link to your help setup for VS ..
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Dec 11th, 2008
0

Re: openin more forms C#

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.!!!
Reputation Points: 10
Solved Threads: 0
Light Poster
nikola.rosic is offline Offline
27 posts
since Jul 2008
Dec 11th, 2008
0

Re: openin more forms C#

Just google c# threads and look for msdn

Please dont forget to mark your issue solved.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Simpel string sorting
Next Thread in C# Forum Timeline: How to sort a List of FileInfo just like in a Windows folder? (Same sort Function)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC