L
Lisa Calla
Hi,
I'm trying to control the foreground and background colors of a textbox. I
hate that light gray foreground when the textbox.enabled=false. I've tried
to derive a control from the textbox, but I get the following error when
trying to run a page with the control on it. wc is the name of my class,
and exp is the name of my project.
Parser Error Message: 'exp.wc' is not a valid base class because it does not
extend class 'System.Web.UI.UserControl'.
Source Error:
Line 1: <%@ Control Language="vb" AutoEventWireup="false"
Codebehind="wc.ascx.vb" Inherits="exp.wc"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
And here's the code:
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class wc
Inherits System.Web.UI.WebControls.TextBox
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
'Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' 'Put user code to initialize the page here
'End Sub
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
If Me.Enabled Then
Me.BackColor = Color.FromName("White")
Else
Me.BackColor = Color.FromName("LightGray")
End If
Me.ForeColor = Color.FromName("Black")
End Sub
End Class
Can anyone explain to me why I get this error?
I'm trying to control the foreground and background colors of a textbox. I
hate that light gray foreground when the textbox.enabled=false. I've tried
to derive a control from the textbox, but I get the following error when
trying to run a page with the control on it. wc is the name of my class,
and exp is the name of my project.
Parser Error Message: 'exp.wc' is not a valid base class because it does not
extend class 'System.Web.UI.UserControl'.
Source Error:
Line 1: <%@ Control Language="vb" AutoEventWireup="false"
Codebehind="wc.ascx.vb" Inherits="exp.wc"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
And here's the code:
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class wc
Inherits System.Web.UI.WebControls.TextBox
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
'Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' 'Put user code to initialize the page here
'End Sub
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
If Me.Enabled Then
Me.BackColor = Color.FromName("White")
Else
Me.BackColor = Color.FromName("LightGray")
End If
Me.ForeColor = Color.FromName("Black")
End Sub
End Class
Can anyone explain to me why I get this error?