kaisersoze Posted December 16, 2005 Posted December 16, 2005 I need to calling a function. If the funtion takes more time to execute then I need to come out of the function. Is there a way. currently my application works as it should, but when bad network, the same function takes time to return, so, the app should try for 30 secionds, if time taken to execute is more than 30 seconds then move forward with next step. please help Quote Note: I think as a programmer not as a human, so use my answer at your will
dick_nl Posted December 16, 2005 Posted December 16, 2005 Tried to put it in a seperate thread!? Quote
Leaders snarfblam Posted December 16, 2005 Leaders Posted December 16, 2005 This is exactly what threading is for. You need to launch this function in a separate thread. This means that the main thread is still free to update the ui and interact with the user (in other words, the program isn't frozen). Since I hardly even qualify as a multithreading novice, that's about all I can tell you, but I'm pretty sure you can find all the help you need on threading in MSDN. Quote [sIGPIC]e[/sIGPIC]
HJB417 Posted December 19, 2005 Posted December 19, 2005 If you're using .net 2.0, check out the BackgroundWorker class, otherwise use advice mentioned above. If you're using wincontrols, you can use the Control.BeginInvoke method. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.