开发者

long running process vb.net

I have a service ticket management application and users want to open several ticket details on a tab in a MDI frame. Since this application has to communicate through Web XML service with other company, it takes around 15 ~20 seconds. The users most complain is that he needs to wait until a saving process is done. Cursor is working while data is bein开发者_运维知识库g saved and other can't be done.

What is the most effective way to let user open other window and do something else or save data while data is being saved from other windows?

By the way, this is VB.Net / Windows Application.


You could use a BackgroundWorker or new thread. I personally would try using built in asynchronous methods, such as BeginInvoke

http://www.developer.com/net/vb/article.php/1443981/Asynchronous-Web-Services-for-Visual-Basic-NET.htm

Keep in mind that asynchronous operations become complicated very quickly, good desighned in very important.


Use BackgroundWorker ...


Refer to the following:

Manage a background process by using the BackgroundWorker component


I've written a web service which is part of a solution which needs to go off and run a method which takes quite a long while to run through. After some experimenting, I decided it was simplest to kick off the long running task in a new thread within the web service and return a custom object to the calling application (which is then used later).

<WebMethod()> Public Function StartChecks() As ResponseItem

    Dim t As New Thread(New ThreadStart(AddressOf Me.StartWork))
    t.Start()

    Return New ResponseItem(CheckGUID.ToString)

End Function
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜