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"

Edited 4 Years Ago by __avd: Remove "leet", "txt" or "chatroom" speak

This article has been dead for over six months. Start a new discussion instead.