title: How to convert memory stream to string array and vice versa
body: <p>I have a code where i want to get an stream from an image and convert the memory stream to string array and store in a variable. But my problem is i also want to get the image from the string variable and paint on a picture box.</p>
  
  <p>If i use this like 
      PictureBox1.Image = image.FromStream(memoryStream)
  I am able to print the picture on picture box. But this is not my need. I just want to get the image stream from file and convert the stream as text and store it to some string variable and again i want to use the string variable and convert it to stream to print the image on picture box.</p>
  
  <p>Here is my Code.(Vb Express 2008)</p>
  
  <pre><code> Public Function ImageConversion(ByVal image As System.Drawing.Image) As String
          If image Is Nothing Then Return ""
  
          Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream
          image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif)
  
          Dim value As String = ""
  
  
          For intCnt As Integer = 0 To memoryStream.ToArray.Length - 1
              value = value &amp; memoryStream.ToArray(intCnt) &amp; "  "
          Next
  
          Dim strAsBytes() As Byte = New System.Text.UTF8Encoding().GetBytes(value)
          Dim ms As New System.IO.MemoryStream(strAsBytes)
  
  
          PictureBox1.Image = image.FromStream(ms)
  
          Return value
      End Function
  </code></pre>