Hi!
I trying to display image in picture box. The application have two part. First part is windows application, and second part is web service (asmx).
This is the code for windows application:
Public Sub PrikazSlike()
Dim p As localhost.Service1 = New localhost.Service1()
PictureBox1.Image = Image.FromStream(p.PictureShow())
End Sub
And this is the code for web service:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.IO
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function PictureShow() As System.IO.MemoryStream
Dim client As New System.Net.WebClient()
Dim stream1 As New System.IO.MemoryStream()
Dim data As Byte() = client.DownloadData("http://www.psp-themes.net/.../assassins%20creed%203.jpg")
client.Dispose()
stream1.Write(data, 0, data.Length)
Return stream1
End Function
End Class
The problem is that function in web service does not return System.IO.MemoryStream data type so I getting error message can not convert: Error 1 Value of type 'WindowsApplication1.localhost.MemoryStream' cannot be converted to 'System.IO.Stream'.
How I can resolve this?
Many thanks!