Hi all,
Does anyone know how to change the color (or highlight) a part of a listbox)??
I need to have the negative amount (if any) highlight automatically during an if statement.
I have looked through my textbook for VB, and the instructor does not think I can because the Outpu string is a variable and not an object
I have a bit of the code at the bottom
anyone have any suggestions??
Thanks in advance
Angela
.........................
strHoursWorked = InputBox("Enter the # of Hours Worked by Employee " & intCount, "Hours Worked")
strHourlyPay = FormatCurrency(InputBox("Enter the Hourly Amount paid to Employee " & intCount, "Hours Pay"))
GrossPay = FormatCurrency(strHoursWorked * strHourlyPay)
strPercentState = InputBox("Enter the Percent State Tax to take out for Employee" & intCount, "State Percent Withheld")
StateWH = FormatCurrency(CDec((strPercentState * GrossPay) * 0.01))
strPercentFederal = InputBox("Enter the Percent Federal Tax to take out for Employee" & intCount, "Federal Percent Withheld")
FederalWH = FormatCurrency(CDec((strPercentFederal * GrossPay) * 0.01))
strPercentFICA = InputBox("Enter the Percent FICA Tax to take out for Employee" & intCount, "Fica Percent Withheld")
FICAwh = FormatCurrency(CDec((strPercentFICA * GrossPay) * 0.01))
NetPay = FormatCurrency((GrossPay - StateWH - FederalWH - FICAwh))
TotalTaxes = FormatCurrency(CDec(FederalWH) + CDec(StateWH) + CDec(FICAwh))
strOut += ("Employee " & intCount)
strOut += (" " & strHoursWorked & "=")
strOut += ("Hours Worked" & ",")
strOut += (" " & strHourlyPay & "=")
strOut += (" Hourly Pay " & ",")
strOut += (" " & strPercentState & "%=")
strOut += (" State Tax" & ",")
strOut += (" " & strPercentFederal & "%=")
strOut += (" Federal Tax" & ",")
strOut += (" " & strPercentFICA & "%=")
strOut += (" FICA Tax")
strOutput += ("Employee " & intCount)
strOutput += (" " & GrossPay & "=")
strOutput += ("Gross Pay" & ",")
strOutput += (" " & StateWH & "=")
strOutput += ("State Taxes" & ",")
strOutput += (" " & FederalWH & "=")
strOutput += ("Federal Taxes" & ",")
strOutput += (" " & FICAwh & "=")
strOutput += ("FICA Taxes" & ",")
strOutput += (" " & NetPay & "=")
strOutput += ("NetPay")
If NetPay <= 0 Then
MessageBox.Show("Withholdings are higher than Gross Pay")
lstPayroll.Items.Add(strOut)
lstPayroll.Items.Add("")
lstPayroll.Items.Add("ERROR...." + strOutput + "....ERROR")
lstPayroll.Items.Add("")
strOutput = Color.Red
Else
lstPayroll.Items.Add(strOut)
lstPayroll.Items.Add("")
lstPayroll.Items.Add(strOutput)
lstPayroll.Items.Add("")
End If
Next
End Sub
End Class
*** I am wanting the the netpay to be flashing red or text to be red when the taxes are larger than the grosspay........I can have the entire listbox highlight, but I only want the employee who this applies to to be highlighted??
anyone have any ideas????
Thanks ;)
ANG