nadiam 0 Posting Pro in Training

Visual Basic 2010 and Microsoft Access 2013

I have a product table in MS with fields : fld_id,fld_name,fld_img,fld_price,fld_type

fld_img i set it as attachment and of course attached the corresponding image to it - is this wrong?

this is my code to get the data into the datagridview. my form uses combobox to select the type of product to display. right now the image column just displays the file name of image. how to display the image instead?

Public Class frm_pl

    Private Sub frm_pl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim getProducts As String = "SELECT FLD_TYPE FROM TBL_PRODUCTS_A154287 GROUP BY FLD_TYPE"
        Dim theTable As New DataTable
        Dim reader As New OleDb.OleDbDataAdapter(getProducts, myconnection)
        reader.Fill(theTable)
        grd_pl.DataSource = theTable

        cmb_type.DataSource = theTable
        cmb_type.DisplayMember = "FLD_TYPE"

        refresh_grid(cmb_type.Text)
    End Sub
    Private Sub refresh_grid(ByVal fld_type As String)
        Dim getProducts As String = "SELECT FLD_PRODUCT_ID,FLD_PRODUCT_NAME,FLD_IMG,FLD_PRICE FROM TBL_PRODUCTS_A154287 WHERE FLD_TYPE = '" & fld_type & "'"
        Dim theTable As New DataTable
        Dim reader As New OleDb.OleDbDataAdapter(getProducts, myconnection)
        reader.Fill(theTable)
        grd_pl.DataSource = theTable

        grd_pl.Columns(0).HeaderText = "Product ID"
        grd_pl.Columns(1).HeaderText = "Name"
        grd_pl.Columns(2).HeaderText = "Image"
        grd_pl.Columns(3).HeaderText = "Price (RM)"
    End Sub
    Private Sub btn_mm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_mm.Click
        frm_mainmenu.Show()
        Me.Hide()
    End Sub

    Private Sub cmb_type_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_type.SelectedIndexChanged
        refresh_grid(cmb_type.Text)
    End Sub
End Class

thanks in advance

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.