Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ps ps is offline
external usenet poster
 
Posts: 1
Default RaiseEvent Problem

In my study of RaiseEvent, I have a Question.
I have 2 Textboxes in UserForm1: TextBox1, TextBox2
When I run, Event is fired only on TextBox2.

TextBox1 does not fire Event.
What is the problem??

my codes...

---(Class1 module)-----
Private WithEvents mTx As MSForms.TextBox
Public Event F1Pressed()

Public Property Set Control(ByRef Ctl As MSForms.TextBox)
Set mTx = Ctl
End Property

Private Sub mTx_KeyDown( _
ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)

If Shift Then Exit Sub
RaiseEvent F1Pressed
End Sub

--(UserForm1 module)---------
Private Col As VBA.Collection
Private WithEvents myCls As Class1


Private Sub UserForm_Initialize()
Dim Ctl As Control

Set Col = New VBA.Collection

For Each Ctl In Controls
If TypeOf Ctl Is MSForms.TextBox Then
Set myCls = New Class1
Set myCls.Control = Ctl
Col.Add myCls
End If
Next

End Sub

Private Sub myCls_F1Pressed()
MsgBox "F1 Clicked"
End Sub





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM
RaiseEvent from a class contained in a 2nd class collection? Andrew[_16_] Excel Programming 2 January 6th 04 04:22 PM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"