title: Printing images in Crystal Reports from VB.Net
body: <p>I want to print an image in Crystal Reports. I got some code from the web but the image doesn't show; only the text "ok" on the first column was shown.</p>
  
  <p>Any suggestions would greatly appreciated. </p>
  
  <p>Thanks in advance</p>
  
  <p>Here is my code</p>
  
  <pre><code>    Dim myRpt As New ImageReport
  
      Dim txtHeader As CrystalDecisions.CrystalReports.Engine.TextObject = myRpt.Section2.ReportObjects("txtHeader")
      txtHeader.Text = "IMAGE AND TEXT"
  
      Dim txtDateNow As CrystalDecisions.CrystalReports.Engine.TextObject = myRpt.Section2.ReportObjects("txtDateNow")
      txtDateNow.Text = Format(Now(), "MMMM d, yyyy")
  
      Dim row As DataRow = Nothing
      Dim DS As New DataSet
  
      'ADD A TABLE TO THE DATASET
      DS.Tables.Add("rp_recipe_cr_image_report")
  
      'ADD THE COLUMNS TO THE TABLE
      With DS.Tables(0).Columns
          .Add("others_t1", Type.GetType("System.String"))
          .Add("image", Type.GetType("System.Byte[]"))
      End With
  
      Dim fs As New FileStream("D:\asianporkroll.Jpg", FileMode.Open)
      Dim br As New BinaryReader(fs)
      Dim lBImageByte As Byte()
  
      lBImageByte = New Byte(fs.Length + 1) {}
      lBImageByte = br.ReadBytes(Convert.ToInt32(fs.Length))
  
      row = DS.Tables(0).NewRow
      row(0) = "ok"
      row(1) = lBImageByte
      DS.Tables(0).Rows.Add(row)
  
      br.Close()
      fs.Close()
  
      myRpt.SetDataSource(DS)
      CrystalReportViewer1.ReportSource = myRpt
      CrystalReportViewer1.Refresh()
  
      'DISPOSE OF THE DATASET
      DS.Dispose()
      DS = Nothing
  </code></pre>