S
sandrofurlan
HI, I'm learning about WCF.
I've written a simple service and I'm trying to write a web-form
client.
On a simple console client that's all right. I've got the problem with
the asynchronous callback in the client.
When I click Button1 the client send request to the service and I
return the callback correctly:
variable 'res' contains the correct return value but not 'Label2'
I'm sure I forgot something, can anybody help me?
PS: sorry for my english
Here's the code for defult.aspx.vb
Imports System.ServiceModel
Partial Class _Default
Inherits System.Web.UI.Page
Private Sub Add_Callback(ByVal ar As IAsyncResult)
Dim Client As CalculatorClient = DirectCast(ar.AsyncState,
CalculatorClient)
Dim res As String = Client.EndAdd(ar)
Label2.text = res '<---Label2.text could non be
refresh!!!!!!!!!!!
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim Client As New CalculatorClient
Label1.Text = Client.Add(CDbl(Text1.Text))
Client.Close()
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim Client As New CalculatorClient
Dim ar As IAsyncResult = Client.BeginAdd(CDbl(Text2.Text), New
AsyncCallback(AddressOf Add_Callback), Client)
End Sub
End Class
Thank you
I've written a simple service and I'm trying to write a web-form
client.
On a simple console client that's all right. I've got the problem with
the asynchronous callback in the client.
When I click Button1 the client send request to the service and I
return the callback correctly:
variable 'res' contains the correct return value but not 'Label2'
I'm sure I forgot something, can anybody help me?
PS: sorry for my english
Here's the code for defult.aspx.vb
Imports System.ServiceModel
Partial Class _Default
Inherits System.Web.UI.Page
Private Sub Add_Callback(ByVal ar As IAsyncResult)
Dim Client As CalculatorClient = DirectCast(ar.AsyncState,
CalculatorClient)
Dim res As String = Client.EndAdd(ar)
Label2.text = res '<---Label2.text could non be
refresh!!!!!!!!!!!
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim Client As New CalculatorClient
Label1.Text = Client.Add(CDbl(Text1.Text))
Client.Close()
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim Client As New CalculatorClient
Dim ar As IAsyncResult = Client.BeginAdd(CDbl(Text2.Text), New
AsyncCallback(AddressOf Add_Callback), Client)
End Sub
End Class
Thank you