Hello friends!
hope someone can help me, i have a problem to display picture from database access in picturebox, i already search it on google, maybe im not lucky today to find article about it. please teach me friend.

mmcdonald, Thanks for reply,
link that you give is a tutorial for display image IN ms access, My question is in the vb.net, so it necessarily is to display pictures FROM ms access TO VB.NET picturebox.
sorry....my english is not too good...

Thanks, yup! im looking like that, but its using wizard to display the picture, for my apps i need to call the picture refer to the query in my form, this is my code:

    Private Sub txtNama_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtNama.MouseClick
        Dim ds As New DataSet
        Dim dt As New DataTable
        ds.Tables.Add(dt)
        Dim a As String = "SELECT NAMA, KURSUS FROM DAFTARPELAJAR WHERE NDP = @NDP"
        Dim b As New OleDbDataAdapter(acscmd)

        acscmd.CommandText = a
        With acscmd.Parameters
            .AddWithValue("@NDP", Trim(txtNDP.Text))
        End With
        b.Fill(dt)
        txtNama.Text = dt.Rows(0).Item(0)
        txtKursus.Text = dt.Rows(0).Item(1)
        acscmd.Parameters.Clear()
    End Sub

i already populate the textbox, but i dont know how to load picture into my picturebox.

Yeah you're going to have to slap me as I can't help any further - only ever once looked at VB and immediately reverted back to web programming :) Now there's a better question here with your code another user could potentially help you, sorry and good luck!

Michael

nvm, i solve the problem, this is my code:

        Dim ds As New DataSet
        Dim dt As New DataTable
        ds.Tables.Add(dt)
        Dim a As String = "SELECT NAMA, KURSUS, Gambar FROM DAFTARPELAJAR WHERE NDP = @NDP"
        Dim b As New OleDbDataAdapter(acscmd)

        acscmd.CommandText = a
        With acscmd.Parameters
            .AddWithValue("@NDP", Trim(txtNDP.Text))
        End With
        b.Fill(dt)
        txtNama.Text = dt.Rows(0).Item(0)
        txtKursus.Text = dt.Rows(0).Item(1)
        acscmd.Parameters.Clear()
        txtNama.Enabled = False
        txtKursus.Enabled = False
        For Each dr As DataRow In dt.Rows
            Dim img_buffer() As Byte
            img_buffer = CType(dr("Gambar"), Byte())
            Dim img_stream As New MemoryStream(img_buffer, True)

            img_stream.Write(img_buffer, 0, img_buffer.Length)
            PictureBox1.Image = New Bitmap(img_stream)
        Next

i just try this code, and its work fine, maybe i need to change a little bit.

Well done! :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.