Yes, sorry - I made a typo. It does work; it's just that it renders the GUI too unresponsive. I'm looking for smooth-ish updating on all of the controls and looping through them (even with Thread.Sleep in there) seems to result in massive CPU load and sluggish display. Perhaps it is something to do with the way in which the thread which performs the invoke calls back to the GUI thread obtains the values to set the component properties to (it's not too bad if I just generate some numbers within the updating thread and use those instead).
Right, got it. Suspicion confirmed. The object I was calling the method on in order to get the values was being blocked by another thread accessing it. Stick the invokes to update the component properties into the same thread and the problem's gone away. Thanks ;P
Hello fellows. I need your help. I have a Windows.Forms application which makes a connection to a database about 5 - 10 seconds. While I'm trying to connect to the database, an animated control starts an animation . After the connection is made I stop the animation and want to run another function to fill a DataGrid control.
private void OpenConFunction()
//... some code
private void AfterConnFunction()
//... some code to fill DataGrid control
private void myButton_Click(object sender, System.EventArgs e)
Thread t = new Thread(new ThreadStart(OpenConFunction));
this.AnimatedControl.Start(); //Suppose AnimatedControl
//has two methods one to start animation and a second one to stop it
What has to be the code after OpenConFunction returns? I want to invoke the AfterConnFunction and stop the AnimatedControl animation?
call the animation method asynchronously , inside which u have following code
//bnFinished flag is class level var and will be set to true when db
//end the async method call..
Thanks for the reply. Unfortunately, your suggestion didn't help me. I think I need to call the OpenConFunction() in a separate thread. But I don't know how to start the AfterConnFunction when OpenConFunction ends.
It's incredible how many people don't even bother with the simplest of things when posting a question.
First thing they should always do is google for an answer.
The second (rule of fight club) thing is they should google again for the answer, and again and again with different keywords until they are sure theres nothing obvious about. Twenty minutes research should not be an unreasonable burden upon someone who is seeking free help.
There there is the problem of txtspk, if you have a limitation of 160 characters because your using SM its ndrstndbl tat u mgt nt use whle wrds. But when typing online you don't have that limitation, the more expressive the language you use the more information you can convey to those your asking for help.
Theres the problem of not providing enough information. Sometimes someone will give you they're interpretation of the error message, which is almost useless for searching with. Another twist is sometimes (and most developers are bad for this) someone will ask about what they think the solution is rather than describing the problem. This means you can spend ages helping with something which actually has nothing to do with the actual issue.
Some people think that it is their right to receive help and demand that you give an answer or give an in depth essay rather than a link to google. They can seem to grasp the fact that you're helping off your own back, your not getting paid to think for them.
How can I determine "day size" of a specific month using a MonthCalender or a DateTimePicker?
--- For example, I put a MonthCalender to my form and it shows the 2007-April month. How can I manage my software that shows me the "April 2007 has totally 30 days"
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )