Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 536937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:52:27+00:00 2026-05-13T09:52:27+00:00

I trying to display image in picture box. The application have two part. First

  • 0

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!

Update (originally posted as an ‘answer’)

This is the update code for web service:

   <WebMethod()> _
    Public Function PrikazSlike() As Byte
        Dim client As New System.Net.WebClient()
        'Dim data As Byte

        Dim data As Byte() = client.DownloadData("http://www.psp-themes.net/.../assassins%20creed%203.jpg")
        Dim stream1 As New System.IO.MemoryStream(data)
        client.Dispose()
        stream1.Write(data, 0, data.Length)
        Return Convert.ToByte(stream1)
    End Function
End Class

This is the windows application code:

Public Sub Show.Picture()
         Dim p As localhost.Service1 = New localhost.Service1()
         PictureBox1.Image = Image.FromStream(p.PictureShow()) 
         End Sub

Now I getting error:

Error 1 Value of type ‘Byte’ cannot be converted to ‘System.IO.Stream’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:52:27+00:00Added an answer on May 13, 2026 at 9:52 am

    The error message says that your method returns the type WindowsApplication1.localhost.MemoryStream and not a System.IO.MemoryStream.

    I suspect that your web service is set up to return a MemoryStream object. Try to change it to return a byte[] array instead. On your receiving side retrieve the byte array and create a System.IO.MemoryStream from that array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I 'm trying to display the thumbnail for a picture or video my app
hi i am trying to show image of my file in previwew pane i
I am trying to upload an image,create thumbnail but i get an error. Here
I'm running into an issue with my program when trying to crop an image
I am trying to make a really easy xml layout and I can't seem
This is the first time I've posted a pic, so hopefully it turns out
I wanted to combine app_themes css files into one on the fly. I did
I am creating a Domino Document via AJAX that contains a photo. I am
sorry if my question kind of doesn't make sense but i am total confused
I need a little help with getting my camera to work right. What I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.