Show blank instead of zero

In a DataGridView I need to show a blank cell when the value in the cell is zero.

Any ideas?

VBE 2010
Who is Participating?
John (Yiannis) ToutountzoglouConnect With a Mentor Instructor Multiengine PilotCommented:
One option is to use the Cell Formatting Event
First define which column you want to set blank cell instead of zero like:
Private Sub DataGridView1_CellFormatting(sender As System.Object, e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
        If e.ColumnIndex = 1  Then 'or 2 or whatever
            If e.Value = 0 Then
                e.Value = ""
            End If
        End If
    End Sub

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.