VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
DataGridViewImageColumn displays incorrectly Posted by jwbutler on 13 Sept 2007 at 11:53 AM
I have a DataGridView that is filled with by a DataSet. I have added an unbound DataGridViewImageColumn so I can display an image in the 1st cell. Once the TableAdapter.Fill method is executed I iterate over all the rows and update the 1st cell's value to a value from an image list. Then I execute the DataGridView.Refresh. This work 90% of the time but the other 10% of the time the image designated in the NullValue property is displayed. Can anyone recommend a fix? Below is a code extract.

Me.TableAdapter.Fill(Me.DataSet.ViewName)
UpdateAuthStatusImage(GridView)
Private Sub UpdateAuthStatusImage(ByRef GridView As DataGridView)
Dim StartDate As Date
Dim EndDate As Date
For Each Row As DataGridViewRow In GridView.Rows
StartDate = Row.Cells(5).Value
EndDate = Row.Cells(6).Value
If StartDate <= Date.Today And Date.Today <= EndDate Then
Row.Cells(0).Value = Me.ilImages.Images(6)
Else
Row.Cells(0).Value = Me.ilImages.Images(7)
End If
Next
GridView.Refresh()
End Sub

Thanks,



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.