T
TJS
when converting this to VB, the result fails , can anyone help ?
C#
private void CreateDayEffects(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
{
e.Cell.Attributes["onmouseover"] = "this.style.backgroundColor='pink';";
if (Calendar1.DayStyle.BackColor != Color.Empty)
e.Cell.Attributes["onmouseout"] = "this.style.backgroundColor='" +
Calendar1.DayStyle.BackColor.ToKnownColor() + "';";
else
e.Cell.Attributes["onmouseout"] = "this.style.backgroundColor='';";
}
VB
Private Sub CreateDayEffects(sender As Object, e As
System.Web.UI.WebControls.DayRenderEventArgs)
e.Cell.Attributes("onmouseover") = "this.style.backgroundColor='pink';"
If myCalendar.DayStyle.BackColor <> Color.Empty Then
e.Cell.Attributes("onmouseout") = "this.style.backgroundColor='" +
myCalendar.DayStyle.BackColor.ToKnownColor() + "';"
Else
e.Cell.Attributes("onmouseout") = "this.style.backgroundColor='';"
End If
End Sub 'CreateDayEffects
ERROR
Compiler Error Message:
BC30452: Operator '<>' is not defined for types 'System.Drawing.Color' and
'System.Drawing.Color'.Source Error:
Line 65: Private Sub CreateDayEffects(sender As Object, e As
System.Web.UI.WebControls.DayRenderEventArgs)
Line 66: e.Cell.Attributes("onmouseover") =
"this.style.backgroundColor='pink';"
Line 67: If myCalendar.DayStyle.BackColor <> Color.Empty Then
Line 68: e.Cell.Attributes("onmouseout") =
"this.style.backgroundColor='" +
myCalendar.DayStyle.BackColor.ToKnownColor() + "';"
Line 69: Else
C#
private void CreateDayEffects(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
{
e.Cell.Attributes["onmouseover"] = "this.style.backgroundColor='pink';";
if (Calendar1.DayStyle.BackColor != Color.Empty)
e.Cell.Attributes["onmouseout"] = "this.style.backgroundColor='" +
Calendar1.DayStyle.BackColor.ToKnownColor() + "';";
else
e.Cell.Attributes["onmouseout"] = "this.style.backgroundColor='';";
}
VB
Private Sub CreateDayEffects(sender As Object, e As
System.Web.UI.WebControls.DayRenderEventArgs)
e.Cell.Attributes("onmouseover") = "this.style.backgroundColor='pink';"
If myCalendar.DayStyle.BackColor <> Color.Empty Then
e.Cell.Attributes("onmouseout") = "this.style.backgroundColor='" +
myCalendar.DayStyle.BackColor.ToKnownColor() + "';"
Else
e.Cell.Attributes("onmouseout") = "this.style.backgroundColor='';"
End If
End Sub 'CreateDayEffects
ERROR
Compiler Error Message:
BC30452: Operator '<>' is not defined for types 'System.Drawing.Color' and
'System.Drawing.Color'.Source Error:
Line 65: Private Sub CreateDayEffects(sender As Object, e As
System.Web.UI.WebControls.DayRenderEventArgs)
Line 66: e.Cell.Attributes("onmouseover") =
"this.style.backgroundColor='pink';"
Line 67: If myCalendar.DayStyle.BackColor <> Color.Empty Then
Line 68: e.Cell.Attributes("onmouseout") =
"this.style.backgroundColor='" +
myCalendar.DayStyle.BackColor.ToKnownColor() + "';"
Line 69: Else