關於webservice的異步調用簡單實例
無論在任何情況下
下面
這是一個webservice
Public Function delCurTable(ByVal tbName As String) As Boolean
Try
Return True
Catch ex As Exception
Return False
End Try
End Function
關於這個webservice的同步調用方法
異步調用
Private a As vbwebservice
Dim ar As IAsyncResult
public sub Callback
end sub
#region
private sub btnStart_Click()
dim cb as asyncallback=new asyncallback(address(me
ar=a
end sub
private sub btnEnd_Click()
if ar is nothing then
exit sub
end if
if ar
dim m as boolean=a
messagebox
end if
end sub
#end region
注意
以上是的用法
CWebService
System
private void Form
{
a=new CWebService
}
public void CallBack
{
}
private void btnStart_Click(object sender
{
System
ar=a
}
private void btnEnd_Click(object sender
{
if(ar==null)
{
MessageBox
return ;
}
if(ar
{
bool m=a
MessageBox
}
else
{
MessageBox
}
}
From:http://tw.wingwit.com/Article/program/net/201311/13208.html