StrataFrame Forum

Change Forecolor in Listview Lines.

http://forum.strataframe.net/Topic29066.aspx

By Marcio Valerio Silva - 11/20/2010

I need to change Forecolor in Listview Lines, during population acording a condition.

For example if a payment date is minor than actual date the line of ListView its should be red if not it should  be Blue, but How Can i do this?
By Edhy Rijo - 11/20/2010

Hi Marcio,

Take a look at the RowPopulating and RowPopulated events of the listview in the help file.

Here is a sample event from one of my forms:

  Private Sub lstTransactions_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgsHandles lstTransactions.RowPopulating
        Using loBO As bizTransaction = DirectCast(e.BusinessObject, bizTransaction)
            e.UseGroup = True
            e.GroupHeaderText = MicroFour.StrataFrame.Tools.Common.GetEnumDisplayValue(loBO.TransactionType)
            e.ImageKey = loBO.TransactionType.ToString

            Select Case loBO.TransactionType
                Case Business.Enumerations.TransactionType.CarrierDeactivation
                    e.RowBackColor = Color.Yellow
                    Me.lblDeactivated.Text = "*** This card has been Deactivated ***"
                    Me.lblDeactivated.Visible = True
                    My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation)

                Case Business.Enumerations.TransactionType.FirstUseImport
                    e.RowBackColor = Color.Yellow
                    Me.lblDeactivated.Text = "*** This card has been Used ***"
                    Me.lblDeactivated.Visible = True
                    My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation)
            End Select
        End Using
    End Sub