How to display a database image in a Vb.net form

Asked

Viewed 110 times

0

I’d like to know how I can show a database image in a Vb.net form.

It’s something like this:

info.TextBox5.Text = DataGridView1.SelectedRows(0).Cells(5).Value 

Only this code I use to display text from the database in a new form. How can I do that with an image?

  • Your image is stored in the database in what format? Binary or base 64?

1 answer

0

If your image is already stored in a hidden column of your DataGridView1, like Bitmap or Image, you just need a Picturebox:

info.PictureBox1.Image = DataGridView1.SelectedRows(0).Cells(6).Value

Like Kaizonaro said, however, depending on how your image is stored, you will have to create the object Image on time, with additional commands, which will vary depending on the case (for example, if you have a binary stream it would be one way, if a Base64 string, another way, etc.)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.