title: How to Display/Get Image from Access Database to PictureBox in VB
body: <pre><code>Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
      GetPicture()
  End Sub
  
  
  Public Sub GetPicture()
  
      con.Open()
  
      Dim dt As New DataTable("Users")
      Dim rs As New OleDb.OleDbDataAdapter("Select * from Users where StudentNumber='" &amp; TextBox1.Text &amp; "' ", con)
      rs.Fill(dt)
      DataGridView1.DataSource = dt
      DataGridView1.Refresh()
      Label1.Text = dt.Rows.Count
      rs.Dispose()
      con.Close()
  
      If Val(Label1.Text) = 1 Then
          Dim i As Integer
          i = DataGridView1.CurrentRow.Index
          PictureBox1.Image = FixNull(DataGridView1.Item(6, i).Value)
  
  
      End If
  ______________________________
  </code></pre>
  
  <p>I got this Error on the line: PictureBox1.Image = FixNull(DataGridView1.Item(6, i).Value)</p>
  
  <p><code>-&gt; Unable to cast object of type 'System.Byte[]' to type 'System.Drawing.Image'.</code></p>
  
  <hr>
  
  <p>Screenshot:<br>
  <img src="https://i.stack.imgur.com/KfgOv.png"></p>