Gonzalo Hevia

Gonzalo Hevia

  • NA
  • 1
  • 1.5k

Silverlight 5, WCF Service and vb.net Language

May 4 2013 2:25 AM

Hi, Im trying to do a very simple Hello World! application just to learn how to get a String returned from a function in a WCF Service, using Silverlight5 and Visual Studio 2012 in vb.net language.

I found how to do this, but only on C#.

here  is my  function inside the WCF:

 <OperationContract()>
    Public Function ReturnHelloString(ByVal number As Integer) As String

        If number = 1 Then
            Return "Hello World!"
        Else
            Return "Bye World!"
        End If

    End Function

and this is how im calling it from my Silverlight application:

 Private Sub SayHello()
        Dim wcf As New ServicioWCF_BD.ServicioBDClient
        Dim message As String = wcf.ReturnStringAsync(1) 'ERROR: THE EXPRESSION DOESNT GENERATE A VALUE
        MessageBox.Show("message")
 End Sub


I'm getting that error in that line.
I also tried to use a Private Async Sub SayHello() as Task, but visual studio gives me an error, saying maybe im targeting the wrong framework, or missing a reference to some assembly.

I hope you can help me. Thanks!