Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Is it possible to write code for an Event of a control in a class module? I wrote a Class Module where I can set a TextBox control. I would like to have the class to handle the AfterUpdate event of this TextBox control. Thanks in advance, Bart |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bart,
Dim WithEvents SomeVar As SomeControl NickHK "Bart" wrote in message ups.com... Hello, Is it possible to write code for an Event of a control in a class module? I wrote a Class Module where I can set a TextBox control. I would like to have the class to handle the AfterUpdate event of this TextBox control. Thanks in advance, Bart |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Very nice construction. Thanks NickHK for the tip!
It seems that the AfterUpdate Event is part of the MSForms.Control Class. So I'm using the following declaration to get the AfterUpdate event: Private WithEvents txtControl As MSForms.Control Now the Events become available in the PickMenu for implemenation. While running the code with the line where I set the TextBox to this txtControl, it gives an error: Run-Time Error '459': Object or Class does not support the set of events I don't get it. What does this mean? I did some playing with implementing Events part of the MSForms.Textbox Class. That worked correctly. Bart |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try this way: Private WithEvents txtControl As MSForms.TextBox regards, Manu/ "Bart" a écrit dans le message de news: ... Very nice construction. Thanks NickHK for the tip! It seems that the AfterUpdate Event is part of the MSForms.Control Class. So I'm using the following declaration to get the AfterUpdate event: Private WithEvents txtControl As MSForms.Control Now the Events become available in the PickMenu for implemenation. While running the code with the line where I set the TextBox to this txtControl, it gives an error: Run-Time Error '459': Object or Class does not support the set of events I don't get it. What does this mean? I did some playing with implementing Events part of the MSForms.Textbox Class. That worked correctly. Bart |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Manu,
The AfterUpdate Event doesn't come available when declaring a variable as MSForms.TextBox Class with Events. I think the MSForms.TextBox inherits the Event from the MSForms.Control Class. Why doesn't the AfterUpdate Event becomes available by Inheritance? Bart |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Some events are inherited from the container object, the UserForm here.
Within the events class, you are effectively trapping a control's events outside of that container, so there is no access to inherited events (they aren't exposed by that control). AfterUpdate is one of these. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Bart" wrote in message ps.com... Very nice construction. Thanks NickHK for the tip! It seems that the AfterUpdate Event is part of the MSForms.Control Class. So I'm using the following declaration to get the AfterUpdate event: Private WithEvents txtControl As MSForms.Control Now the Events become available in the PickMenu for implemenation. While running the code with the line where I set the TextBox to this txtControl, it gives an error: Run-Time Error '459': Object or Class does not support the set of events I don't get it. What does this mean? I did some playing with implementing Events part of the MSForms.Textbox Class. That worked correctly. Bart |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bob! That makes sense.
There's no other way to trap the AfterUpdate Event inherted by the TextBox outside its Container (UserForm)? Bart |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don't think so, I use the Change event in the class and AfterUpdate in the
form. A pain, but unavoidable I believe. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Bart" wrote in message ups.com... Thanks Bob! That makes sense. There's no other way to trap the AfterUpdate Event inherted by the TextBox outside its Container (UserForm)? Bart |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Class Events | Excel Programming | |||
Useing Class structures and Events | Excel Programming | |||
class events stop firing with ADO 2.8 | Excel Programming | |||
Events, Class, Time Editing | Excel Programming | |||
What events can be captured in a Class Module? | Excel Programming |