V
VB Programmer
I have code that changes the bkground color of the webform on page_load.
Here it is:
Dim Body As New HtmlGenericControl
Body = CType(Page.Controls(1), HtmlGenericControl)
Body.Attributes("bgcolor") =
ConfigurationSettings.AppSettings("BackgroundColor")
I'm getting this error message "System.InvalidCastException: Specified cast
is not valid." at this line:
Body = CType(Page.Controls(1), HtmlGenericControl)
But, because Option Strict is On I have to cast it (no implicit
conversions).
Any ideas?
Thanks!
Here it is:
Dim Body As New HtmlGenericControl
Body = CType(Page.Controls(1), HtmlGenericControl)
Body.Attributes("bgcolor") =
ConfigurationSettings.AppSettings("BackgroundColor")
I'm getting this error message "System.InvalidCastException: Specified cast
is not valid." at this line:
Body = CType(Page.Controls(1), HtmlGenericControl)
But, because Option Strict is On I have to cast it (no implicit
conversions).
Any ideas?
Thanks!