Add column containing image to DGV
Hello,
I am generating the contents for my DGV by using the following code:
Code:
Dim strMEDEWERKER As String = "IIf(isnull(tblMEDEWERKER.Voorvoegsel),tblMEDEWERKER.Voornaam & ' ' & tblMEDEWERKER.Achternaam,tblMEDEWERKER.Voornaam & ' ' &tblMEDEWERKER.Voorvoegsel & ' ' & tblMEDEWERKER.Achternaam)"
Dim strComm As String = String.Format("SELECT tblMEDEWERKER.Medewerker_ID, " & _
"{0} AS VolledigeNaam, " & _
"tblMEDEWERKER.Postcode, " & _
"tblMEDEWERKER.Plaats, " & _
"tblMEDEWERKER.Achternaam, " & _
"tblMEDEWERKER.Voornaam, " & _
"tblMEDEWERKER.Voorvoegsel " & _
"FROM tblMEDEWERKER " & _
"WHERE {1} " & _
"AND {2} " & _
"AND {3} " & _
"AND {4} ", _
strMEDEWERKER, _
strZoekMedewerker_ID, _
strZoekPostcode, _
strZoekPlaats, _
strZoekVolledigeNaam) 'IIf(txtZoekPlaats.Text = "", "is null AND tblMEDEWERKER.Plaats <> NULL", "like '%" & txtZoekPlaats.Text & "%'"), _
'Debug.WriteLine(strComm) 'Copy the string from the Debug window
Dim adapter As New OleDbDataAdapter(strComm, connection)
Dim table As New DataTable
adapter.Fill(table)
With dgvMedewerker
.DataSource = table
.Visible = True
End With
I would like to add a column containing an image to the end of the DGV.
I searched the forum but didn't find anything to fit my needs.
Could you please give me a push in the right direction?
Thanks in advance
Re: Add column containing image to DGV
You simply add a DataGridViewImageColumn to the grid. You can do it in the designer or in code. If you do it in the designer then you will need to change the DisplayIndex after binding the data.