5 Replies - 382 Views - Last Post: 19 October 2018 - 09:49 AM Rate Topic: -----

#1 aspfun   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 96
  • Joined: 16-January 13

Win form control to display binary data as MemoryStream

Posted 18 October 2018 - 04:36 AM

I am looking for a win form control to display binary data as MemoryStream.
The binary source are converted from GIF, JPG, TIF, HTML image file and stored in a SQL table.
Please help.
Is This A Good Question/Topic? 0
  • +

Replies To: Win form control to display binary data as MemoryStream

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14577
  • View blog
  • Posts: 58,440
  • Joined: 12-June 08

Re: Win form control to display binary data as MemoryStream

Posted 18 October 2018 - 06:44 AM

Quote

a win form control to display binary data as MemoryStream.

Explain this, because 'memory stream' is not really a visual GUI thing.
Was This Post Helpful? 0
  • +
  • -

#3 aspfun   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 96
  • Joined: 16-January 13

Re: Win form control to display binary data as MemoryStream

Posted 18 October 2018 - 06:58 AM

I used Telerik RadPDFViewer as code below but it only display PDF file.

 Dim imageInBytes As Byte() = ds.Tables(0).Rows(0)("IMAGECOPY")//IMAGECOPY IS FROM A CELL, IS BINARY DATA
Dim stream As Stream = New MemoryStream(imageInBytes)
RadPdfViewer1.LoadDocument(stream) 

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14577
  • View blog
  • Posts: 58,440
  • Joined: 12-June 08

Re: Win form control to display binary data as MemoryStream

Posted 18 October 2018 - 07:06 AM

.... soooooooooo what? I am not sure where the PDF comes into play.

You are trying to display the binary array of data, of an image, in the picturebox control?
Was This Post Helpful? 0
  • +
  • -

#5 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 149
  • View blog
  • Posts: 964
  • Joined: 05-December 13

Re: Win form control to display binary data as MemoryStream

Posted 19 October 2018 - 08:07 AM

Controls can not be anything other than what they are. A textbox can not be a memory stream, but some controls can output the data of a memory stream. In your first post you didn't mention a pdf, but regardless what the file type is, you would be using a binary reader, and for convenience if you want to write binary files, use a binary writer. If you can provide a bit more information on what you're doing, you'll get a more precise answer.

Typically, I use a MemoryStream if I need a stream, but I don't want anything to hit the harddisk drive, and I use a FileStream when writing a file to the harddisk. A file stream reads from a file, and a memory stream can be used to read data mapped in the computer's internal memory (RAM). You need to decide which one is better to use, and why you are using it? Do you want your files to hit the disk? Something worth noting, if your available memory is low, and your file size exceeds the allocated memory chains size, the stream will start paging to the disk, which in turn will degrade the whole system. Consider this if you are reading writing big files.

This post has been edited by Sheepings: 19 October 2018 - 09:52 AM

Was This Post Helpful? 0
  • +
  • -

#6 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1554
  • View blog
  • Posts: 4,930
  • Joined: 20-March 10

Re: Win form control to display binary data as MemoryStream

Posted 19 October 2018 - 09:49 AM

I think the pdf viewer crept in as the OP didnt know he could just

Dim stream As Stream = New MemoryStream(imageInBytes)



then use the stream to create an Image.

Then use a PictureBox control to display the Image

somewhat like

Dim myImage As Image = Image.FromStream(stream)
PictureBox1.Image = MyImage

This post has been edited by snoopy11: 19 October 2018 - 09:50 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1