title: Unable to cast object of type 'System.Byte[]' to type 'System.Drawing.Image' in windows application
body: <p>I have a data grid view,in update button i wrote code like this:</p>
  
  <pre><code>Dim cid As Integer
          Dim dtid As Integer
          Dim cmpname As String
          Dim dtname As String
          Dim dtPhone As String
          Dim dtEmail As String
          Dim dtimage As Image
  
  
          For i As Integer = 0 To gv.RowCount - 2
              ' Dim rv = DirectCast(bSource.Current, DataRowView)
              Dim rv = DirectCast(gv.Rows(i).DataBoundItem, DataRowView)
              cid = rv.Row.Field(Of Integer)("Cid")
  
              dtid = rv.Row.Field(Of Integer)("dtId")
              cmpname = rv.Row.Field(Of String)("CompanyName")
              dtname = rv.Row.Field(Of String)("Department")
              dtPhone = rv.Row.Field(Of String)("Phone")
              dtEmail = rv.Row.Field(Of String)("Email")
              dtimage = rv.Row.Field(Of Image)("empimage")
  
              adapter.UpdateCommand = New SqlCommand("UPDATE CompanyMaster_tbl SET CompanyName = @CompanyName", con.connect)
              adapter.UpdateCommand = New SqlCommand("update DepartmentMaster_tbl set dtName = @dtName,dtPhone = @dtPhone,dtEmail = @dtEmail,empimage=@dtimage  where dtId=@dtid", con.connect)
              adapter.UpdateCommand.Parameters.AddWithValue("@Cid", cid)
  
              adapter.UpdateCommand.Parameters.AddWithValue("@CompanyName", cmpname)
              adapter.UpdateCommand.Parameters.AddWithValue("@dtId", dtid)
              adapter.UpdateCommand.Parameters.AddWithValue("@dtName", dtname)
              adapter.UpdateCommand.Parameters.AddWithValue("@dtPhone", dtPhone)
              adapter.UpdateCommand.Parameters.AddWithValue("@dtEmail", dtEmail)
              adapter.UpdateCommand.Parameters.AddWithValue("@dtimage", dtimage)
              adapter.UpdateCommand.ExecuteNonQuery()
  </code></pre>
  
  <p>but i am getting error in this line
   <strong>dtimage = rv.Row.Field(Of Image)("empimage")</strong> :<em>Unable to cast object of type 'System.Byte[]' to type 'System.Drawing.Image'</em></p>