Re: deriving from textbox control

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Matt Berther (mberther_at_hotmail.com)
Date: 10/22/04


Date: Fri, 22 Oct 2004 11:15:28 -0700

Hello Lisa,

Gosh... wouldnt the easier alternative be to use CSS?

input {
    border: 1px solid black;
}

--
Matt Berther
http://www.mattberther.com
> 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?
> 


Relevant Pages

  • Re: Simple Insert Into...
    ... You can store unbound control data in a variable, ... in the sql. ... Dim strSQL As String ... In your form's Sub, you'll wind up with something like the following: ...
    (microsoft.public.access.modulesdaovba)
  • Re: Simple Insert Into...
    ... it is in a control on the form; and is unbound (it's actually a combo ... box that is used as a dropdown list, values taken from a different table; SQL ... I need this value to assign a unique ID to the entire recordset being ... In your form's Sub, you'll wind up with something like the following: ...
    (microsoft.public.access.modulesdaovba)
  • Re: stephen lebans tool tip
    ... ListBox control. ... > Private Sub cboFindACustomer_MouseMove(Button As Integer, ... > ' Set the text for the txtCustomerID label. ...
    (microsoft.public.access.forms)
  • Re: Change textbox/combobox colors with a procedure
    ... as I have more that a few variables depending on the measurement type. ... The Form's Current event procedure title is: Private Sub Form_Current ... Private Sub FormatControl(CTRL As Control) ...
    (microsoft.public.access.formscoding)
  • Re: System.ArithmeticException in VStudio 2003
    ... > blank form to a project, then I add a default control of ... > Public Sub New ... > InitializeComponent() call ... > 'Required by the Windows Form Designer ...
    (microsoft.public.dotnet.languages.vb)