Capturing and USING control names in a standard module 
Author Message
 Capturing and USING control names in a standard module

Greetings,

I am trying to capture then use a control name from a SUB-
form and subsequently change its properties from a
standard modlue outside of the form.

A simple example would be for a user to move a cursor over
a control (within a subform) causing it to "Glow"
(changing the forcolor) when the mouse is over it and then
return back to normal when it moves off the control.

but I would like this code to work outside the form-module
so that it can be re-usable regardless of what subform/
form takes advantage of this code

Thanks and appreciation in advance...

Jerry Tilden



Sun, 09 May 2004 07:04:51 GMT  
 Capturing and USING control names in a standard module
Jerry,
Actually it is very easy to do. First, create a function (Not a Sub!) in a
standard module which accepts a control as a parameter. Example:

Public Function Test(ctl As Control)
Static former As Control
If (Not former Is Nothing Or former Is ctl) Then
    former.ForeColor = 0
End If
Set former = ctl
ctl.ForeColor = vbRed
End Function

This function will be your custom event handler. In control's On Mouse Move
property field type =test([YourControlName]). In form's On Mouse Move
property type
=test([YourDefaultControlName]) - this may be even invisible control if you
wish. Of course, substitute 'test' to whatever you want.

HTH,

Alex.


Quote:
> Greetings,

> I am trying to capture then use a control name from a SUB-
> form and subsequently change its properties from a
> standard modlue outside of the form.

> A simple example would be for a user to move a cursor over
> a control (within a subform) causing it to "Glow"
> (changing the forcolor) when the mouse is over it and then
> return back to normal when it moves off the control.

> but I would like this code to work outside the form-module
> so that it can be re-usable regardless of what subform/
> form takes advantage of this code

> Thanks and appreciation in advance...

> Jerry Tilden




Sat, 08 May 2004 23:58:12 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using .SetFocus from a standard module

2. Using mscomm in standard module

3. Referencing an instance of a control, from a standard module

4. Using XP Common Controls as opposed to Standard VB6 Controls

5. control naming standards?

6. #Name? Problem using Public variables across Modules

7. Returning the name of a module/class module

8. using a control or a control resource in a module

9. Module name and method name of caller?

10. Retrieve name of current sub/function and name of current module

11. selecting index with data control using vb3 standard

12. How do I capture the Enter key on a standard Textbox

 

 
Powered by phpBB® Forum Software