473,416 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Last Active Control

How do you return the last Active Control when the control is on a tab
control? Screen.ActiveControl does not seem to work. Here's the
statement that my code uses.

Set ctlOld = Screen.ActiveControl

The code line work when all controls are placed on the form page
rather than a tab control. This code should pass the last active
control to the calling module. Then the following line requests the
tabindex from the control.

Nov 12 '05 #1
3 10031
> How do you return the last Active Control when the control is on a tab
control? Screen.ActiveControl does not seem to work. Here's the
statement that my code uses. Set ctlOld = Screen.ActiveControl
Just tested on a tab control:
Debug.Print Screen.ActiveControl.Name
Debug.Print Screen.PreviousControl.Name

Both returned the correct control names.
The code line work when all controls are placed on the form page
rather than a tab control. This code should pass the last active
control to the calling module. Then the following line requests the
tabindex from the control.


?? Can you post the line that doesn't work?

Peter
--
No mails please.
Nov 12 '05 #2
Thanks Peter for your response.

Ok, the issue did not lie with the following statement.

Set ctlOld = Screen.ActiveControl

The dilemma related to the method the code enumerated through the
controls in conjunction with the tab order. My debugging efforts
alarmed me since the screen object did not register when activating a
watch on the variable. Further research outlined that the screen
object would not register if debugging through the VBA editor's window
since the Screen object is no longer the form or control.

Does any other method or function allow you to capture the active
control or previous control AND allow one to debug and watch the
variable? This information would help me develop more complex code
where debugging becomes essential.
On Wed, 17 Sep 2003 10:31:36 +0200, Peter Doering <ne**@doering.org>
wrote:
How do you return the last Active Control when the control is on a tab
control? Screen.ActiveControl does not seem to work. Here's the
statement that my code uses.

Set ctlOld = Screen.ActiveControl


Just tested on a tab control:
Debug.Print Screen.ActiveControl.Name
Debug.Print Screen.PreviousControl.Name

Both returned the correct control names.
The code line work when all controls are placed on the form page
rather than a tab control. This code should pass the last active
control to the calling module. Then the following line requests the
tabindex from the control.


?? Can you post the line that doesn't work?

Peter

Nov 12 '05 #3
Robert,
Ok, the issue did not lie with the following statement. Set ctlOld = Screen.ActiveControl The dilemma related to the method the code enumerated through the
controls in conjunction with the tab order. My debugging efforts
alarmed me since the screen object did not register when activating a
watch on the variable. Further research outlined that the screen
object would not register if debugging through the VBA editor's window
since the Screen object is no longer the form or control. Does any other method or function allow you to capture the active
control or previous control AND allow one to debug and watch the
variable? This information would help me develop more complex code
where debugging becomes essential.
If debugging is the problem you can set the breakpoint _after_ this line:
Set ctlOld = Screen.ActiveControl


Then it will be executed on the right object, before changing to the code
window.

HTH - Peter

--
No mails please.
Nov 12 '05 #4

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

Similar topics

2
by: Georges Heinesch | last post by:
Hi. Is it possible to change the position of the cursor inside an active control? In my example ... Me!txtControl.Text = Me!txtControl.Text .... puts the cursor to the left side of the...
3
by: Hank | last post by:
On one of my forms I display a histogram representing the status of jobs in our factory. It's configured as a stacked bar which I create using labels of different background colors. 75 labels are...
6
by: Woody Splawn | last post by:
I know that I can do the following to identify the parent name of an active control Dim sParentName As String = ActiveControl.Parent.Name But how do I identify the name of the active control?...
4
by: Volker Jobst | last post by:
Hi, Is there an event of windows.forms.form which informs me that the active control will be changed before it will be changed? Something like: Private Sub Form_Validating(ByVal sender As...
4
by: amnonevo | last post by:
Any equivalent to VB's PreviousControl in VB.NET?
0
by: Mark Chen | last post by:
Hello : My problem is my active control will download to IE6 sp2, but not download to IE6 sp1. On IE6 sp1, ther is no popup to ask for download. Mark
1
by: techCrazy | last post by:
How do I go to last 'active' tab? :tabp goes to current tab - 1. tabp *:tabp* *:tabprevious* *gT* :tabN *:tabN* *:tabNext* gT Go to the previous tab page. Wraps around from the...
2
by: Randy | last post by:
I have a form on which various controls are added dynamically depending on actions of the user. One of these actions allows the user to click a delete button that will remove various other...
7
by: Andrus | last post by:
I have UserControls in MDI child forms containing TextBoxes and other controls. When user re-activates form, I need that Control which was last activated is activated again. Currently *first*...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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,...
0
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...
0
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,...
0
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...

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.