bound datagridview with unbound image column

shawne

Well-known member
Joined
Feb 22, 2006
Messages
103
Location
Pennsylvania
Programming Experience
10+
I want to change an image in my unbound image column based on data from another column. The below code does nothing though. Does not produce an error or change the image for the current row. The datagridview is data bound with an unbound image column added programmatically. For the life of me I cannot figure out why it's not updating the cell. Thanks for any help!

pingColumn is defined at the top of the form as:

VB.NET:
Public pingColumn As New DataGridViewImageColumn()
DataGridView1.Columns("online").Visible = False
DataGridView1.Columns.Insert(0, pingColumn)

With pingColumn
.Image = My.Resources.offline2
.Name = "Status"
.HeaderText = "Ping status"
End With

For i As Int16 = 1 To DataGridView1.Rows.Count - 1
DataGridView1.CurrentCell = DataGridView1(0, i)
DataGridView1.BeginEdit(True)
Select Case DataGridView1.Item(1, i).Value.ToString
Case "yes"
DataGridView1(0, i).Value = My.Resources.online2
Case "no"
DataGridView1(0, i).Value = My.Resources.offline2
Case Else
DataGridView1(0, i).Value = My.Resources.offline2
End Select
DataGridView1.EndEdit()
Next
 
Back
Top