T
tjmii
I'm trying to use several web user controls on a page that share some common
functionality. So, I want the user controls to inherit from a base class.
I started off making this simple base class
Public Class BaseClass : Inherits System.Web.UI.UserControl
Public Property TableWidth as Integer
Get
Return baseTable.Width
End Get
Set (ByVal Value As Integer)
baseTable.Width = Value
End Set
End Property
Protected WithEvents baseTable As System.Web.UI.WebControls.Table
End Class
I have the code behind for a child class called ChildControl that looks like
this
Public MustInherit Class ChildControl : Inherits BaseClass
' Standard wizard generated code here...
End Class
This code compiles and runs without any problems, but I'm unable to open my
user control in the form designer anymore. I get the following error:
"The file failed to load in the Web Form Designer. Please correct the
following error, then load it again: Property accessor TableWidth on object
ChildControl threw the following exception: 'Object reference not set to an
instance of an object.'"
Is this a known bug with the form designer? Is there any work around so I
can have my control inherit from a base class AND be able to edit it in the
form designer?
Tom
functionality. So, I want the user controls to inherit from a base class.
I started off making this simple base class
Public Class BaseClass : Inherits System.Web.UI.UserControl
Public Property TableWidth as Integer
Get
Return baseTable.Width
End Get
Set (ByVal Value As Integer)
baseTable.Width = Value
End Set
End Property
Protected WithEvents baseTable As System.Web.UI.WebControls.Table
End Class
I have the code behind for a child class called ChildControl that looks like
this
Public MustInherit Class ChildControl : Inherits BaseClass
' Standard wizard generated code here...
End Class
This code compiles and runs without any problems, but I'm unable to open my
user control in the form designer anymore. I get the following error:
"The file failed to load in the Web Form Designer. Please correct the
following error, then load it again: Property accessor TableWidth on object
ChildControl threw the following exception: 'Object reference not set to an
instance of an object.'"
Is this a known bug with the form designer? Is there any work around so I
can have my control inherit from a base class AND be able to edit it in the
form designer?
Tom