Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
AnswerRe: disable taskmanager Pin
tgrt5-May-08 5:42
tgrt5-May-08 5:42 
AnswerRe: disable taskmanager Pin
Dave Kreskowiak5-May-08 6:48
mveDave Kreskowiak5-May-08 6:48 
AnswerRe: disable taskmanager Pin
Giorgi Dalakishvili5-May-08 8:07
mentorGiorgi Dalakishvili5-May-08 8:07 
AnswerRe: disable taskmanager Pin
PIEBALDconsult5-May-08 8:44
mvePIEBALDconsult5-May-08 8:44 
QuestionAdd login form to a program? Pin
daden2035-May-08 4:48
daden2035-May-08 4:48 
AnswerRe: Add login form to a program? Pin
carbon_golem5-May-08 6:51
carbon_golem5-May-08 6:51 
Questionhow I know that which property is associated which file at run time. Pin
Guru Call5-May-08 4:47
Guru Call5-May-08 4:47 
QuestionRunning a form in a diferent Thread Pin
oscarderooij5-May-08 4:07
oscarderooij5-May-08 4:07 
Hi there,

First of all let me say that I tried to find this here in codeproject and google... but I think I'm missing the keywords to find what I want.

What I'm looking for I think it is pretty common.
The thing is... after learning about delegates and threads and trying to implement it in my project I'm still having a freez while the client draws grids.

Let's go to the details:
I have a mainprogram that calls diferent forms from its menu.
One of this forms needs to draw graphics and (Xceed) Grids with lot of data.
The problem: while drawing these graphics and grids, the whole program freezes (all open forms, this form and the mainprogram).

While trying to solve this problem I started researching about delegates, threads and everything else that popped up in the articles. With all I learned I was able to do some things in my project that increased its performance. But in this particular problem, even when the "drawing function" is put in another thread, the mainprogram continues to freez.

I really want to understand why this is happening and how to solve this, so please tell me if I'm wrong.
I'm guessing that the problem happens because the "drawing function" needs to be runned in the same thread as the "form creator" thread, in this case the mainprogram. This way, although the "drawing function" is called through a delegate, its begin starts with "if (this.invokeRequired) this.Invoke" to avoid cross threading problem.

I don't really know in wich thread the "this.Invoke" will execute my "drawing function" but I'm almost certain that is in the mainprogram's one. So it will keep on freezing.

With this in mind I looked in google and here at codeproject the only way I though of to solve this: a way to run the Form in a diferent thread from the mainprogram. Just like as it was a diferent process. This way the "this.Invoke" would call the paralel thread that runs only the Form, and not the whole mainprogram, stopping the freez problem.

I didn't find something that made me do this succesfully and that brings me here.
Can anyone teach me a way to work around this problem? If there is a way to solve this without creating a thread for this form alone, please, I would like to hear it (if creating a thread is a solution at all... I really don't know).

If I said something wrong, I'm sorry, I'm still a jr here. Please tell me so I can learn better about this.

Thanks in advance,
Oscar
AnswerRe: Running a form in a diferent Thread Pin
S. Senthil Kumar5-May-08 5:34
S. Senthil Kumar5-May-08 5:34 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij6-May-08 2:29
oscarderooij6-May-08 2:29 
GeneralRe: Running a form in a diferent Thread Pin
S. Senthil Kumar6-May-08 2:54
S. Senthil Kumar6-May-08 2:54 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:27
oscarderooij13-May-08 3:27 
AnswerRe: Running a form in a diferent Thread Pin
Luc Pattyn5-May-08 7:19
sitebuilderLuc Pattyn5-May-08 7:19 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij6-May-08 2:42
oscarderooij6-May-08 2:42 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn6-May-08 4:21
sitebuilderLuc Pattyn6-May-08 4:21 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:25
oscarderooij13-May-08 3:25 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn13-May-08 3:45
sitebuilderLuc Pattyn13-May-08 3:45 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:28
oscarderooij13-May-08 3:28 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn13-May-08 3:40
sitebuilderLuc Pattyn13-May-08 3:40 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij15-May-08 7:45
oscarderooij15-May-08 7:45 
QuestionForeach property in myClass Pin
Harvey Saayman5-May-08 3:57
Harvey Saayman5-May-08 3:57 
AnswerRe: Foreach property in myClass Pin
Colin Angus Mackay5-May-08 4:04
Colin Angus Mackay5-May-08 4:04 
AnswerRe: Foreach property in myClass Pin
S. Senthil Kumar5-May-08 4:06
S. Senthil Kumar5-May-08 4:06 
GeneralRe: Foreach property in myClass Pin
Harvey Saayman5-May-08 4:12
Harvey Saayman5-May-08 4:12 
GeneralRe: Foreach property in myClass Pin
carbon_golem5-May-08 5:01
carbon_golem5-May-08 5:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.