|
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));
t.Start();
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?
|
|
|
|
|
i would recommend u a simplest way...
call the animation method asynchronously , inside which u have following code
{
this.AnimatedControl.start();
while(!bnFinishedFlag)
{
//do nothing
//bnFinished flag is class level var and will be set to true when db
//operation finishes
}
this.AnimatedControl.stop();
//end the async method call..
}
hope this helps//..
|
|
|
|
|
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.
|
|
|
|
|
I mean when I start the OpenConnFunction() in a separate thread the animation starts otherwise not
|
|
|
|
|
You can do this using Invoke and delegates. In your OpenConFunction method, once you are done openig the connection you can do an
this.BeginInvoke( new AfterConnFunctionDelegate( AfterConnFunction) )
where AfterConnFunctionDelegate is declared as a delegate with the same type as AfterConnFunction.
public delegate void AfterConnFunctionDelegate();
In the AfterConnFunction method you can safely call this.AnimatedControl.Stop()
--------------------------------------------------
|
|
|
|
|
Brilliant!! Thank you
|
|
|
|
|
hi ,
i use c# web services to retrieve data from a provider.
I would like to log incoming and outgoing xml soap messages when i call a method and when a response arrives..
is there a way to do this ?
|
|
|
|
|
|
Hi friends
How to connect a database in c#
thanks in advance
KK
|
|
|
|
|
|
Hi, I have a ToolStrip control with a BackgroundImage that I would like to align to the right. Is there any way to do this? /Thanks
-- modified at 8:43 Tuesday 3rd April, 2007
|
|
|
|
|
hi
iam getting the following error while i am updating database . here i am getting data from XL sheet
Cannot update. Database or object is read-only
can u plz give me ur ideas
thank u
Suresh.R
|
|
|
|
|
I assume by XL you mean Excel ... I know typing 3 more letters might take up your valuable time but being accurate might help when asking a question
The clue is in what the error message says. Why would it be read only? Possibly because the file has the read only flag set, also possibly because you have the file open in another application?
|
|
|
|
|
originSH wrote: I assume by XL you mean Excel ... I know typing 3 more letters might take up your valuable time but being accurate might help when asking a question
Got my "5" for posting this!
Where is this kind of writing coming from? SMS, chatrooms or am I simply to old?
All the best,
Martin
|
|
|
|
|
it is what i call txtspk and I hate it. It comes from mobile phone sms messages having a limited keyboard/screen/text length. Something which is not the case on a message board such as CP.
|
|
|
|
|
J4amieC wrote: and I hate it
J4amieC wrote: Something which is not the case on a message board such as CP.
Well said!
Thanks!
|
|
|
|
|
and subject says a lot about the problem v@!@@
SIVAJI - THE BOSS
|
|
|
|
|
again, Well said!
|
|
|
|
|
I always thought people learned to type like that because back in the old days, they had to pay for every keystroke.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
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.
|
|
|
|
|
Hi dear friends,
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"
Thanks...
memix
|
|
|
|
|
DateTime.DaysInMonth
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 )
|
|
|
|
|
DateTime.DaysInMonth() is enough for me.
Thank you...
memix
|
|
|
|
|
Hey all
I have a TableLayoutPanel on a form, this form is inherited a number of times by others. This works fine but some of these forms do not need all the rows that are on the default table. I can't see any way of removing a particular row from the layout (ie row 3) on the new forms load. Can this actually be done at run time? It just seems wrong if you can't...
Thanks in advance.
|
|
|
|