title: How can I show a picture on a form in VB.NET?
body: <p>I am creating questionnaires using VB.NET and SQL and my problem now is how can I show an image already present in the database onto a form? Please note that as the form is a questionnaire, it is navigable by the means of going up or down rows in a dataset. For example when the NEXT button is clicked, the row in the dataset goes +1. So how should I go about coding it in order to display an image onto the form?</p>
  
  <p>this is the code how i saved the image</p>
  
  <pre><code>Dim ms As New MemoryStream()
  PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat)
  Dim data As Byte() = ms.GetBuffer()
  Dim x As New SqlParameter("@image", SqlDbType.Image)
  x.Value = data
  cmd.Parameters.Add(x)
  </code></pre>
  
  <p>And the code for navigating between rows of a dataset in a single form:</p>
  
  <pre><code>RichTextBox1.Text = dsquestionnaire.Tables(0).Rows(qsno).Item("Question") .....
  
  qsno + 1 (As a part of the NEXT button click event)
  </code></pre>
  
  <p>Thanks in advance..</p>