Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
430
Summary caption nightmares - "Sum =" Wont go away
posted

I currently have a custom format for a summary that when the value is zero it should display blank. Unfortunately I cant seem to get rid of the "Sum =" Ive tried modifying it on the summary change event of the grid and six ways from sunday inside the custom format. Code posted below:

In the init grid:

 .Summaries.Add(SummaryType.Sum, .Columns(PayAmount)).DisplayFormatProvider = New NumberFormatProvider

Class NumberFormatProvider

Public Class NumberFormatProvider
    Implements IFormatProvider, ICustomFormatter

    Public Function Format(format1 As String, arg As Object, formatProvider As System.IFormatProvider) As String Implements System.ICustomFormatter.Format

        Try
            If TypeOf arg Is Decimal Then

                Return HandleOtherFormats("$0.00", arg)

            End If
        Catch ex As Exception
            Throw ex
        End Try

    End Function

    Public Function GetFormat(formatType As System.Type) As Object Implements System.IFormatProvider.GetFormat

        If formatType Is GetType(System.ICustomFormatter) Then
            Return Me
        Else
            Return Nothing
        End If

    End Function

    Private Function HandleOtherFormats(fmt As String, arg As Object) As String
        If TypeOf arg Is IFormattable AndAlso arg <> 0 Then
            Return DirectCast(arg, IFormattable).ToString(fmt, Me)
        Else
            Return ""
        End If
    End Function

End Class

Please help!