ajax
Posts: 5
|
Posted: 10/20/2008, 6:35 PM |
|
I have a Date label named Due Date; I need the font color to change to red if the due date has passed, can someone point me in the right direction. I did find the code to change Text color but not for a Date range.
|
|
|
Nicole
Posts: 586
|
Posted: 10/22/2008, 12:59 AM |
|
Ajax,
I think I can help you. You can use a code like this in the Before Show event of Label control. The solution is applicable for labels which Data Type is set to Date.
DateTime d = DateTime.Parse(FormNameLabelName.Text);
if (d < DateTime.Now) FormNameLabelName.Text = "<font color=\"red\">" + FormNameLabelName.Text + "</font>";
Remember to set Content property of the Label to HTML.
_________________
Regards,
Nicole |
|
|
ajax
Posts: 5
|
Posted: 10/22/2008, 8:16 AM |
|
Thanks Nicole, worked perfictly once I convert it from C# to VB.Net.
Dim d As DateTime = DateTime.Parse(CompanyStages_Results_StaDueDate.Text)
If d < DateTime.Now Then
CompanyStages_Results_StaDueDate.Text = "<font color=""red"">" + CompanyStages_Results_StaDueDate.Text + "</font>"
End If
Thanks again
|
|
|
ajax
Posts: 5
|
Posted: 10/22/2008, 8:16 AM |
|
sorry posted 2x
|
|
|
|