S
Samuel
Hi All,
I am in the process of converting a VS 2003 project to VS 2005 project (VB.NET Class Library).
It gives the error in TypeOf and DirectCast statements. It was working perfectly under VS2003.
Public Shared Sub Clear(ByVal ctl As HtmlControls.HtmlControl)
If TypeOf ctl Is DropDownList Then
DirectCast(ctl, DropDownList).Items.Clear()
End If
End Sub
1) The error is Expression of type 'System.Web.UI.HtmlControls.HtmlControl' can never be of type 'System.Web.UI.WebControls.DropDownList'.
2) Value of type 'System.Web.UI.HtmlControls.HtmlControl' cannot be converted to 'System.Web.UI.WebControls.DropDownList'
How I can avoid these errors, I tried changing the Option Strict option to Off. I cannot change the code because the TypeOf and DirectCast statements are used in more than 200 places.
Thanks & Regards,
Sam
I am in the process of converting a VS 2003 project to VS 2005 project (VB.NET Class Library).
It gives the error in TypeOf and DirectCast statements. It was working perfectly under VS2003.
Public Shared Sub Clear(ByVal ctl As HtmlControls.HtmlControl)
If TypeOf ctl Is DropDownList Then
DirectCast(ctl, DropDownList).Items.Clear()
End If
End Sub
1) The error is Expression of type 'System.Web.UI.HtmlControls.HtmlControl' can never be of type 'System.Web.UI.WebControls.DropDownList'.
2) Value of type 'System.Web.UI.HtmlControls.HtmlControl' cannot be converted to 'System.Web.UI.WebControls.DropDownList'
How I can avoid these errors, I tried changing the Option Strict option to Off. I cannot change the code because the TypeOf and DirectCast statements are used in more than 200 places.
Thanks & Regards,
Sam