hexOffender
Programmer
Fr a VB2003 windows app, I want the forecolor to change if the Employee is not active.
If ds.Tables(0).Rows(introwindex)(4).ToString = "N" Then
With objListviewItem
.ForeColor = Color.Red
.Text = ds.Tables(0).Rows(introwindex).Item("Last Name")
.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("First Name"))
.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("Department"))
Dim s As String = "{" + (ds.Tables(0).Rows(introwindex)(3)).ToString + "}"
.SubItems.Add(s)
ListView1.Items.Add(objListviewItem)
objListviewItem.ForeColor = Color.Red
End With
Else
objListviewItem.Text = ds.Tables(0).Rows(introwindex).Item("Last Name")
objListviewItem.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("First Name"))
objListviewItem.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("Department"))
Dim s As String = "{" + (ds.Tables(0).Rows(introwindex)(3)).ToString + "}"
objListviewItem.SubItems.Add(s)
ListView1.Items.Add(objListviewItem)
End If
Next introwindex
When I step through the code, I can watch the value of the table in the dataset ( from (introwindex)(column 4)) and see that ist is in fact "N" as it should be, but the If statement will not execute the True path code and jumps to the else path.
If ds.Tables(0).Rows(introwindex)(4).ToString = "N" Then
With objListviewItem
.ForeColor = Color.Red
.Text = ds.Tables(0).Rows(introwindex).Item("Last Name")
.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("First Name"))
.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("Department"))
Dim s As String = "{" + (ds.Tables(0).Rows(introwindex)(3)).ToString + "}"
.SubItems.Add(s)
ListView1.Items.Add(objListviewItem)
objListviewItem.ForeColor = Color.Red
End With
Else
objListviewItem.Text = ds.Tables(0).Rows(introwindex).Item("Last Name")
objListviewItem.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("First Name"))
objListviewItem.SubItems.Add(ds.Tables(0).Rows(introwindex).Item("Department"))
Dim s As String = "{" + (ds.Tables(0).Rows(introwindex)(3)).ToString + "}"
objListviewItem.SubItems.Add(s)
ListView1.Items.Add(objListviewItem)
End If
Next introwindex
When I step through the code, I can watch the value of the table in the dataset ( from (introwindex)(column 4)) and see that ist is in fact "N" as it should be, but the If statement will not execute the True path code and jumps to the else path.