Dear All
I am using this code to display image in datagridview which is ok with jpg image format but if any record has jpeg2000 format I got invalid parameters.
After trying a lot of solutions I found FreeImage tools to solve this error with jpeg2000 format but I don't know how to use it in vb.net to dispaly both format jpg & jpeg2000.
Code:
OleDbDataAdapter1.SelectCommand = OleDbSelectCommand1
OleDbSelectCommand1.CommandText = "SELECT P_IMAGE FROM PORTLOB
OleDbSelectCommand1.Connection = OleDbConnection1
DataSet11.PORT_IMAGE.Clear()
OleDbConnection1.Open()
Try
OleDbDataAdapter1.Fill(DataSet11)
Dim c As Integer = DataSet11.Tables("PORT_IMAGE").Rows.Count
If c > 0 Then
Dim ba() As Byte = DataSet11.Tables("PORT_IMAGE").Rows(c - 1)("P_IMAGE")
Dim tc As TypeConverter = TypeDescriptor.GetConverter(GetType(Bitmap))
Dim bmp As Bitmap = tc.ConvertFrom(ba)
DataGridView1.DataSource = DataSet11.Tables("PORT_IMAGE")
For Each Item As DataGridViewRow In DataGridView1.Rows
Item.Height = 250
Next
End If
Catch Ex As OleDb.OleDbException
MessageBox.Show(Ex.Message)
End Try
OleDbConnection1.Close()
Thanks and Best Regards