• ashish.chaudhari (1/29/2009)


    I am using Function in Report properties->Code to defined the colors and passing the value to this function.

    However if i had to control the colors depending on numeric values ( in decimals) the follwoing function does not allow it. Any idea?

    For eg

    if i want to control color if status in between -0.5 to +0.5 color = Yellow

    it does not allow?

    If i change the GetColor(ByVal status as string) as string from string to int or numeric it gives error,

    Any idea why ?

    Public Function GetColor(ByVal status as string) as string

    IF status <0 Then

    Return "Red"

    End IF

    IF status > 0 Then

    Return "Green"

    End IF

    IF status like "0" Then

    Return "Yellow"

    End IF

    End Function

    Ashish,

    Just try to use datatype Object instead of String and Decimal.

    E.g.

    Public Function GetColor(ByVal status as Object) as string

    IF status < 0 Then

    Return "Red"

    ElseIF status = 0 Then

    Return "Yellow"

    Else

    Return "Green"

    End IF

    End Function