1 Attachment(s)
StrikeOut Items in ListBox Control
Anyone know how I can StrikeOut certain items in a ListBox control?
I'm trying to check and see if a certain row is Enabled, if it isn't then I want to StrikeOut that row, but my code is striking out the entire listbox.
VB Code:
Private Sub LoadJobRules(ByVal strJobID As String)
Dim dtRules As JHALibrary.ADORoutines.CDataTableAdvanced
Dim drRules As DataRow
dtRules = mclsDML.dt_Get_Rules_By_JobID(strJobID)
If dtRules.Rows.Count > 0 Then
lstRules.DataSource = dtRules
lstRules.DataValueField = "RuleID"
lstRules.DataTextField = "RuleName"
For Each drRules In dtRules.Rows
If drRules("IsEnabled").ToString = "0" Then
[color=red]PROBLEM IS HERE[/color]
lstRules.Font.Strikeout = True
End If
Next
lstRules.DataBind()
End If
End Sub
The first item is the only one disabled, therefore it should be the only item that is "Struck Through", but as you can see, all the items are this way.
I know I need to tie into the item itself, but I'm not exactly sure how to do it.
Re: StrikeOut Items in ListBox Control