-
Find name of next control from Validate
Inside the Validate event ActiveControl is still the control firing Validate.
How do you get the name of the control that WILL be active once Validate
exits?
-
Re: Find name of next control from Validate
If by the next control you mean the one that is next in the Tab order, then
consider this
Dim cntl As Control
......
......
For Each cntl In Controls
If Screen.ActiveControl.TabIndex + 1 _
= cntl.TabIndex Then
Debug.Print cntl.Name & " is the next control"
End If
Next
Rick
"Randy" <ranbar@pipeline.com> wrote in message
news:3a89a410$1@news.devx.com...
>
>
> Inside the Validate event ActiveControl is still the control firing
Validate.
> How do you get the name of the control that WILL be active once Validate
> exits?
-
Re: Find name of next control from Validate
Rick,
Actually, I am executing code in a validate event that branches based upon
which command button was clicked. I guess I can get this if I subclass WM_KILLFOCUS,
which gives you the handle of the control about to receive the focus, but
i'd rather avoid that method.
Randy
"Rick Rothstein" <rick_newsgroup@email.com> wrote:
>If by the next control you mean the one that is next in the Tab order, then
>consider this
>
> Dim cntl As Control
> ......
> ......
> For Each cntl In Controls
> If Screen.ActiveControl.TabIndex + 1 _
> = cntl.TabIndex Then
> Debug.Print cntl.Name & " is the next control"
> End If
> Next
>
>Rick
>
>
>"Randy" <ranbar@pipeline.com> wrote in message
>news:3a89a410$1@news.devx.com...
>>
>>
>> Inside the Validate event ActiveControl is still the control firing
>Validate.
>> How do you get the name of the control that WILL be active once Validate
>> exits?
>
>
-
Re: Find name of next control from Validate
Randy,
>Actually, I am executing code in a validate event that branches based upon
>which command button was clicked. I guess I can get this if I subclass WM_KILLFOCUS,
>which gives you the handle of the control about to receive the focus, but
>i'd rather avoid that method.
Sad news. That may be your only solution. 
Either the Validate event fires before WM_KILLFOCUS, or VB has simply chosen
not to give this information away. Either way it looks like subclassing
is your answer.
--Kenny
-
Re: Find name of next control from Validate
Randy,
Ignore my previous post. There is a way you can cheat. The LostFocus event
will fire after the control has lost focus, which means you can use the ActiveControl
property. You can use the Validate event to decide what to do, then use
the LostFocus event to do it.
--Kenny
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks