Re: How To: Colour Flash TextBox background?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: One Handed Man \( OHM - Terry Burns \) ("One)
Date: 07/10/04


Date: Sat, 10 Jul 2004 11:06:47 +0100

I normally would not have put the Try/Catch here, but when I was debugging I
was getting some exceptions.

-- 
OHM ( Terry Burns )
 . . .  One-Handed-Man . . .
Time flies when you don't know what you're doing
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:epItXJfZEHA.2444@tk2msftngp13.phx.gbl...
> * "One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> scripsit:
> > Public Class xTimer
> >     Inherits Timer
> >
> >     Public Sub New()
> >         MyBase.New()
> >     End Sub
> >
> >     Private m_control As Control
> >     Public Property xControl() As Control
> >         Get
> >             Return m_control
> >         End Get
> >         Set(ByVal Value As Control)
> >             m_control = Value
> >         End Set
> >     End Property
> >
> > End Class
> >
> >
> > // FORM
> >     Private WithEvents MyTimer As New xTimer
> >     Private FlipBackColor As Boolean = True
> >
> >     Private Sub MyTimer_Tick(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles MyTimer.Tick
> >         Dim tim As xTimer = DirectCast(sender, xTimer)
> >         Dim xText As TextBox
> >         Try
> >             xText = tim.xControl()
> >             If FlipBackColor Then
> >                 xText.BackColor = Color.Red
> >                 FlipBackColor = False
> >             Else
> >                 xText.BackColor = Color.White
> >                 FlipBackColor = True
> >         End If
> >         Catch ex As Exception
> >           'TODO:
> >         End Try
>
> What exceptions are you expecting here?
>
> BTW:  I don't see any advantages in adding the reference to the control to
the timer, and then placing the
> 'Tick' event handler to the form.  Instead, I would extend the textbox,
> instantiate the timer in the extended textbox to keep the stuff outside
> the form's implementation (better encapsulation).
>
> -- 
> Herfried K. Wagner [MVP]
> <URL:http://dotnet.mvps.org/>


Relevant Pages

  • Re: reading mouse wheel rotation in VB6
    ... I need to control a step motor from a computer via ... Private Sub Form_Load ... Private Sub Form_Unload ... ' Pass message on to the original window message handler ...
    (microsoft.public.vb.general.discussion)
  • Re: How To: Colour Flash TextBox background?
    ... Public Sub New ... Private m_control As Control ... Public Property xControl() As Control ... > What exceptions are you expecting here? ...
    (microsoft.public.dotnet.general)
  • Re: one for the gurus
    ... >Public Sub UnHookWheel() ... 'Private Sub UserForm_Initialize ... 'Dim i As Integer ... > site to say that Mabry have discontinued the control as well. ...
    (microsoft.public.excel.programming)
  • Re: Find where ContentControl is located
    ... I guess by the time the event has fired the Selection no longer refers to the table that housed the control? ... Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, ...
    (microsoft.public.word.vba.general)
  • Re: ThreadSafe Query
    ... is there any advantage to creating a private ... > Your class doesn't need to be a Control. ... >>basic class that is just a class, i.e. doesn't inherit from anything). ... >>a sub in TestClass that handles this event and obviously this sub cannot ...
    (microsoft.public.dotnet.framework.compactframework)