Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Note: I think as a programmer not as a human, so use my answer at your will
  • Leaders
Posted
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.
[sIGPIC]e[/sIGPIC]
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...