Hello everyone,
I am trying to edit a data grid I have for contacts in which we display certain items (name, phone number, status, etc). I want to show if their status is deceased, for that word to be red. So far after scouring the forms I did this:
Sub grdContactsCustomDrawCell(Sender, ByRef Node, ByRef Column, IsSelected, IsFocused, ByRef Text, ByRef Color, ByRef Alignment, ByRef Font, ByRef FontColor)
Dim sFieldName
Dim vStatus
Dim lColumnIndex
sFieldName = UCase ( "STATUS" ) ' Field you want to look for
Select Case sFieldName
Case "A1.STATUS" ' ALIAS name of the column in QB
lColumnIndex = GetColumnIndexByFieldName ( grdContacts,"A1.STATUS" ) ' Used so that grid can be sorted/grouped
vStatus = Node.Values ( lColumnIndex ) ' Gets the actual value
End Select
If Not IsNull ( vStatus ) Then ' Ensure you check for Nulls
Select Case vStatus
Case "Active"
FontColor = clBlack ' in v7.x - you can use enum of clBlack, clGreen etc
Case "Inactive"
FontColor = clRed
Case "Deceased"
FontColor = clRed
Font.Bold = True
End Select
End If
End Sub
This is not working however, and I am not sure where I am messing up. Any feedback would be great.
|