Color change in ActiveControl | Bytes (2024)

Home Posts Topics Members FAQ

Chuck

I have a form with 3 related fields. If data is entered into 1 field, the
other 2 related fields are updated automatically. I would like to indicate
on the form into which field the data was initially entered by a) changing
the color of the text or b) by changing the color of the background. Have
tried using Screen.ActiveCe ll.Backcolor = xxx upon entering the cell but
have not had any luck. Would appreciate help.

Chuck

Nov 13 '05 #1

Subscribe Reply

7 Color change in ActiveControl | Bytes (1) 4971 Color change in ActiveControl | Bytes (2)

MLH

I use this for changing color of a control OnGotFocus...
=Change2Green(" Forms![frmCustEntryfrm VehicleEntryFor m]![OwnerID]
OnGotFocus event procedure")

I use this for changing color of a control OnLostFocus...
=Change2Gray("F orms![frmVehicleEntry Form]![OwnerID] OnLostFocus event
procedure")

Maybe you can modif them somehow to get what you want. Here's a basic
color changer procedure...

Function Change2DarkGree n()
Dim MyControl As Control
Set MyControl = Screen.ActiveCo ntrol
MyControl.BackC olor = 32768

'This function can be called from most anywhere. However, when
first opening a form
'and going to the very first control - if called, this code
pukes. You have to handle
'that a different way: Me![ControlName].BackColor=6528 0 works
just fine when entered
'as code-behind-form on the OnGotFocus property for the
control. This is ONLY for the
'very first control on a form. All subsequent controls can
call this function without
'any problem whatsoever!

End Function

xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx\
On Sat, 18 Jun 2005 09:46:18 -0700, "Chuck" <ch*****@comcas t.net>
wrote:

I have a form with 3 related fields. If data is entered into 1 field, the
other 2 related fields are updated automatically. I would like to indicate
on the form into which field the data was initially entered by a) changing
the color of the text or b) by changing the color of the background. Have
tried using Screen.ActiveCe ll.Backcolor = xxx upon entering the cell but
have not had any luck. Would appreciate help.

Chuck

Nov 13 '05 #2

MLH

Sorry, Chuck...
Better use this format for the color changer procedure. I gave
you an earlier one that I don't use much any more.

Function Change2Gray(Cal lingProcedure As String)
On Error GoTo Change2Gray_Err

Dim MyControl As Control
Set MyControl = Screen.ActiveCo ntrol
MyControl.BackC olor = 12632256

Change2Gray_Exi t:
Exit Function

Change2Gray_Err :
Dim r As String, Z As String, Message3 As String
r = "The following unexpected error occurred in Function
Change2Gray() when called from " & CallingProcedur e & ":"
Z = CRLF & CRLF & Str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & Z
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume Change2Gray_Exi t

End Function

Nov 13 '05 #3

Chuck Goldstein

MLH,

Reallu appreciate your help. Tried to use your input,but no success.
Wanted to attach the trial mdb, only 4 fields, 160K unzipped (14K
zipped) but don't know how. If you can either tell me how, or send your
email address I'll get it to you asap.

Chuck

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #4

Chuck Goldstein

MHL,

Found out what the problem was. The back color only shows in Form View.
I have been in Datasheet View. I wanted to see, in Datasheet View, the
initial input field highlighted, somehow, in every initial input field
for all records. Is that possible?

Chuck

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #5

MLH

You've got me there. I have never tried datasheet
view. Don't know why not. Just never thought I
needed it for anything.

xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxx

On Sat, 18 Jun 2005 23:15:00 GMT, Chuck Goldstein <ch*****@acm.or g>
wrote:

MHL,

Found out what the problem was. The back color only shows in Form View.
I have been in Datasheet View. I wanted to see, in Datasheet View, the
initial input field highlighted, somehow, in every initial input field
for all records. Is that possible?

Chuck

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #6

Chuck Goldstein

Thanks, MLH. I appreciate your responses, nonetheless. At least I now
know how to do this of cells in Form Mode. If I ever find out how to do
it in Display ode, I'll let you know.

Chuck
*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #7

MLH

Alright.

Nov 13 '05 #8

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

Similar topics

1 2370

Form.ActiveControl method does not work for control created at run-time ???

by: James Ramaley |last post by:

I am creating a ListView control at run-time and show it on my form. The control appears on the screen and responds to keyboard input. However, the form's ActiveControl method returns a reference to itself when it should return a reference to my ListView control, wheareas in other cases it works correctly. Any ideas why this happens and how I...

Visual Basic .NET

2 1295

Get ActiveControl on Validating event

by: Sam |last post by:

Hi, I have a MDI Application. The MDI parent contains a treeview control, and the childform contains a textbox. If I leave the textbox by clicking on the treeview, then MDIParentForm.ActiveControl is the child form instead of being the treeview. This only occurs under VS2005. It works fine under VS2003. Can you help ? Here is a sample...

Visual Basic .NET

1186

Query ActiveControl within Datagrid Cell LostFocus event wrong control!

by: Greg |last post by:

I'd like to know which contol the focus of a cell in a datagrid is being lost to. Querying ActiveControl.Name within the LostFocus event gives me a blank string, instead of the name of a button I have pressed. When does the name ofthe active control become accessible? Greg.

C# / C Sharp

4 1385

[VB2005EE] accessing control-specific functions via form's ActiveControl

by: Aphazel |last post by:

I got serveral textboxes in a form and want to copy/cut/paste text to clipboard from currently selected (focused) textbox. It's simple to cut/copy/paste when using specified control directly ie Me.TextBox1.Cut() But there's no .Cut() function when i try to use Me.ActiveControl. Is the a way to access textbox'es .Cut() via ActiveControl...

Visual Basic .NET

1072

How does one know if ActiveControl is readonly or not?

by: Rick Shaw |last post by:

Hi, I need to determine if the current ActiveControl is ReadOnly. I need to find this out in the Form's keypress event. How do I go about doing this? Also, I have a control this is a datagridview. In this datagridview I have some columns that are set to readonly, how do I check on Form's keypress event if the key pressed happened on a...

C# / C Sharp

2 6311

Can't get ActiveControl from Form_Current event

by: Bob Darlington |last post by:

When I run the following code from a continuous form's Current event: Set ctrl = Me.ActiveControl I get an error 2474 - 'The expression you entered requires the control to be in the active window'. I've tested it in simple (1 field) forms with no other code, and get the same result. Is it not possible to get this value from the Form_Current...

Microsoft Access / VBA

4 4291

Control's, Focus, and Change focus

by: Jon Slaughter |last post by:

I've created some custom controls and forms that allow the feature to temporarily transfer focus to a control that has been entered by the mouse. Everything seems to work fine but the problem I have is that sometimes I seem to loose the original "holder" of focus and when the user hits tab while using "temporary" focus(while the mouse is over...

C# / C Sharp

1 2506

ActiveControl problem

by: unknown; |last post by:

hello, i've got a question about active control. i'm buillding an application witch uses me.activeControl a few times to check some things. Now something strange happends.. when i click on a combobox ((Infragistics datagrid.comobobox) named ''comboGender" and i check the properties in the watch window:

Visual Basic .NET

3 9440

How to detect the changing of ActiveControl property on a winform?

by: nano2k |last post by:

Each form has its ActiveControl property, but no ActiveControlChanged event to signal that the active control has changed (like ParentChanged event). I tried to trick the form by declaring this property in my form: public new Control ActiveControl { get{ return base.ActiveControl; } set{ base.ActiveControl = value; } }

C# / C Sharp

7778

What is ONU?

by: marktang |last post by:

ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...

General

8017

Problem With Comparison Operator <=> in G++

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. ...

C / C++

8201

Maximizing Business Potential: The Nexus of Website Design and Digital Marketing

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...

Online Marketing

1 7777

The easy way to turn off automatic updates for Windows 10/11

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...

Windows Server

8063

Discussion: How does Zigbee compare with other wireless protocols in smart home applications?

by: tracyyun |last post by:

Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...

General

6413

AI Job Threat for Devs

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...

Career Advice

3731

Trying to create a lan-to-lan vpn between two differents networks

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...

Networking - Hardware / Configuration

1 1300

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

1039

Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy

by: bsmnconsultancy |last post by:

In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

General

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

To disable or enable advertisem*nts and analytics tracking please visit the page.

Color change in ActiveControl | Bytes (2024)
Top Articles
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6076

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.