Silverlight 5, return from WCF Ria Service, VB.NET - Simple Hello World -


i can't found on website (yeah.. took couple or hours searching/reading/testing), way call simple hello world function return, , show user.

here wcf class code:

imports system.servicemodel imports system.servicemodel.activation  <servicecontract(namespace:="servicio")> <aspnetcompatibilityrequirements(requirementsmode:=aspnetcompatibilityrequirementsmode.allowed)> public class serviciobd  <operationcontract()> public function returnstring(byval number integer) string      if number = 1         return "hello world!"     else         return "bye world!"     end if  end function 

i added service name "serviciowcf_bd".

and how im calling mainpage.xaml:

private sub sayhello() dim wcf new serviciowcf_bd.serviciobdclient     dim message string = wcf.returnstringasync(1)  'error expression doesnt generate value     messagebox.show(message) end sub 

when try value function visual says error: "the expression doesnt generate value".

i hope can me, first time im stuck hard looks simple..... * sigh *

the return value of wcf.returnstringasync(1) is, probably, of type task , not string.

your sayhello sub should like:

private sub sayhello()     dim wcf new serviciowcf_bd.serviciobdclient     dim message string = wcf.returnstringasync(1).result     messagebox.show(message) end sub 

or, depending you're calling from:

private async function sayhello() task     dim wcf new serviciowcf_bd.serviciobdclient     dim message string = await wcf.returnstringasync(1)     messagebox.show(message) end sub 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -