Insert image into datagridview

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2006
Posts: 32
Reputation: StatiX is an unknown quantity at this point 
Solved Threads: 2
StatiX's Avatar
StatiX StatiX is offline Offline
Light Poster

Insert image into datagridview

 
0
  #1
Nov 3rd, 2007
I have created an image column in my datagridview and want to populate the grid based on the result of a database query. I'm able to pull the data from the database and populate the fields fine, but the image column where I want to display the image shows a broken image, this is the code I'm using:
  1. Dim thispri As Bitmap
  2.  
  3. Do
  4. While SQLdr.Read()
  5. 'Build Grid Data
  6. If (SQLdr("priority") = "high") Then
  7. thispri = New Bitmap("C:\VB...\hpri.bmp")
  8. ElseIf (SQLdr("priority") = "medium") Then
  9. thispri = New Bitmap("C:\VB...\mpri.bmp")
  10. ElseIf (SQLdr("priority") = "low") Then
  11. thispri = New Bitmap("C:\VB...\lpri.bmp")
  12.  
  13. End If
  14. mainData.Rows.Add(...)
  15.  
  16.  
  17. End While

I'm using the full path to the images, shortened here because of longtail location.
Always do what you wish you could..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC