Hi christing,
如果你的 DataGridView 未能从数据库找到数据,就会出现这种情况。
问题应该和你提供的代码无关,检查你从数据库中加载图片的方法。
比如在你从数据库显示图片的方法里修改或尝试以下代码:
For Each row As DataGridViewRow In DataGridView1.Rows
If DBNull.Value.Equals(row.Cells("PRODUCT_PICTURE").Value) Then
row.Cells("PRODUCT_PICTURE").Value = New Bitmap(1, 1)
End If
If DBNull.Value.Equals(row.Cells("PRODUCT_PICTURE1").Value) Then
row.Cells("PRODUCT_PICTURE1").Value = New Bitmap(1, 1)
End If
Next
希望可以帮助你解决问题。
Best Regards,
Xingyu Zhao
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.