hello !
i am using mssql server 2008 , i have a table with three fields , 1- ProdID 2-ProdName 3-ProdPic , now i want to show the all records of the table in the datagridview by using vb.net , how can i show my image field in datagridview , even i create three columns , and the third column has column type image. now i dont know how to bound my datagrid with my datatable . i am using code like this

dim con as new sqlconnection("connection string")
con.open()
dim da as new sqldataadapter("select ProdID,ProdName,ProdPic",con)
dim dt as new datatable
da.fill(dt)
datagridview.datasource = dt
con.close()

now prob is that i dont know how to bind my grid columns with my dt , , please guid me so that i can complete my project.

Best Regards

If you would have been storing the file path then you could have used the following code

          Dim img As New DataGridViewImageColumn()
          Dim inImg As Image = Image.FromFile("C:\Users\pooja\Desktop\images\abc\Logo.jpg")
          img.Image = inImg
          DataGridView1.Columns.Add(img)
          img.HeaderText = "Image"
          img.Name = "img"
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.