473,756 Members | 8,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To: Colour Flash TextBox background?

While at first this may seem a simple tast, it has plagued me for a while...

What I want to do is to have the background colour of something like a TextBox
to change from (say) White to Yellow to White to Yellow and then back to White
in about 1 second or so.

This is to create something like a 'flash' (or a Pulse) for when a User clicks
on 1 of 4 Radio Buttons (which change the Text in the TextBox). So in other
words, to get the User's attention that the Text has Changed. Popup boxes are
a pain, so I don't want to go there (ie: they may click several RadioButtons).

I've tried something simple like the following to Test this out. But you do
not 'see' any background change happening. So obvious, I'm missing something
fundamental here:

Private Sub rbASME1_Checked Changed(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles rbASME1.Checked Changed
pltPrefx = "a"
txbScrName.Text = pltPrefx & pltTitle & pltType
Dim TimCtr, TimX As Integer
For TimX = 1 To 4
If TimX = 1 Then txbScrName.Back Color = Color.Yellow
If TimX = 2 Then txbScrName.Back Color = Color.White
If TimX = 3 Then txbScrName.Back Color = Color.Yellow
If TimX = 4 Then txbScrName.Back Color = Color.White
For TimCtr = 0 To 200000
Next 'timx
Next ' timctr
txbScrName.Back Color = Color.White
End Sub

Anyone else done something similar? I think I tried a Timer Control a while
back also without success...

Regards,

Bruce
Jul 21 '05
11 2491
With Deft Fingers, "One Handed Man \( OHM - Terry Burns \)"
<news.microsoft .com> wrote:
There ya go MR. B., a more comprehensive answer ! - (Tested I Might Add )
----------------------------------------------------------------------------


As always... Thanks! (seems like I'm doing that to you alot these days) (:

Regards,

Bruce
Jul 21 '05 #11
No problem. Its all part of the learning process. Herfied pointed out that
the TextBox could have been extended and a timer instantiated in each one.
This is also a possibility. However, I chose not to do it this way to reduce
resources, with H's suggestion you should create a user control something
like this.

This actually works but a little more effort needs to go into it so when you
stop the flash, you set the color to white, and also you need to set the
m_FlashRate of the Timer in the constructor so it allways initialises to a
standard acceptable rate, even though you can change it, or you could
overload the constructor and pass this valiable in that way, up 2 u.

HTH

Public Class MyTextBox
Inherits System.Windows. Forms.UserContr ol

Private FlipColor As Boolean = True
Private m_FlashState As Boolean = False
Private m_FlashRate As Int32 = 250

Public Property FlashRate() As Int32
Get
Return m_FlashRate
End Get
Set(ByVal Value As Int32)
m_FlashRate = Value
Me.Timer1.Inter val = m_FlashRate
End Set
End Property

Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles Timer1.Tick

If FlipColor Then
Me.TextBox1.Bac kColor = Color.Red
FlipColor = False
Else
Me.TextBox1.Bac kColor = Color.Aquamarin e
FlipColor = True
End If
End Sub

Public Property Flash() As Boolean
Get
Return m_FlashState
End Get
Set(ByVal Value As Boolean)
m_FlashState = Value
If Value Then
Me.Timer1.Start ()
Else
Me.Timer1.Stop( )
End If
End Set
End Property

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Mr. B" <Us**@NoWhere.c om> wrote in message
news:in******** *************** *********@4ax.c om...
With Deft Fingers, "One Handed Man \( OHM - Terry Burns \)"
<news.microsoft .com> wrote:
There ya go MR. B., a more comprehensive answer ! - (Tested I Might
Add )
--------------------------------------------------------------------------- -
As always... Thanks! (seems like I'm doing that to you alot these days) (:
Regards,

Bruce

Jul 21 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2489
by: Dj Frenzy | last post by:
Hi, I know how to use javascript to change a background image to another background image, and how to change a background colour to another background colour. Is there a way to change an image to a backgound colour? I have a table with a background that has a picture. When the user hovers over the picture I want the background to change to the background colour of the rest of the page, as if to make the picture disappear.
1
1470
by: JD | last post by:
How do i get rid of the 1st column that appears in a datagrid? I do not want this? Also how do i change the colour of the background of a cell when the user selects it. i.e for the first coloumn i have made this non-editable and therefore i do not want the graey colour that appears when the user clicks on a cell in the first row. As only my second row is editable, i only want a click colour for this coloumn
3
4144
by: Hans Karman | last post by:
Is it possible to set the background colour for each record in a continuous form to the colour stored in a datafield within that record? Hans Karman, Canberra, Australia
11
5635
by: Mr. B | last post by:
While at first this may seem a simple tast, it has plagued me for a while... What I want to do is to have the background colour of something like a TextBox to change from (say) White to Yellow to White to Yellow and then back to White in about 1 second or so. This is to create something like a 'flash' (or a Pulse) for when a User clicks on 1 of 4 Radio Buttons (which change the Text in the TextBox). So in other words, to get the...
7
11814
by: garyusenet | last post by:
I'm using krypton toolkit which has allowed me to make a cool looking form. However, when I set my textbox to disabled it is 'greyed' out. The grey colour isn't in keeping with the office 2007 style look of my form. How can i change the colour that control assumed when it's disabled? Thanks! Gary-
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.