Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lost Enter/Exit from standard text box events in Class

Status
Not open for further replies.

vbaprogammer

Programmer
Sep 16, 1999
59
US
I have created the following to reuse my code for textboxes by creating a class to handle the enter and exit events.

I can get the change event and several others after running this code, but what happened to the enter and exit? I really do need the enter and exit events.

This code is placed in my Form:

Dim cTB1 As CTextBox
Dim cTB2 As CTextBox

Private Sub UserForm_Initialize()
Set cTB1 = New CTextBox
Set cTB2 = New CTextBox

Set cTB1.Control = Me!TextBox1
Set cTB2.Control = Me!TextBox2

End Sub

This code is placed in my CTextBox class:

Public WithEvents mTextBox As TextBox

Public Property Set Control(ByVal ctlNewControl As TextBox)
Set mTextBox = ctlNewControl
End Property

Private Sub mTextBox_Change()
MsgBox "You're in the Change event of the CTextBox class."
End Sub

============
Thanks,

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top