VBA

Moderators: PavlinII
Number of threads: 1673
Number of posts: 3078

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Creating an Event handler - bad news Posted by izthar on 4 Mar 2012 at 12:16 PM
I found a solution!!!

I have a user form named frmCalendario with a frame, the frame contains 42 labels, where de label1 name is lbl1, label2 name is lbl2, ... label42 name is lbl42.

class Module "clsLabel" code:

Public WithEvents myLabel As MSForms.Label

Private Sub myLabel_Click()
msgbox("myLabel Event")
End Sub

user form code:
Private WithEvents lbl As Label
Private newLabel() As clsLabel

Private Sub UserForm_Initialize()
Dim i As Integer
Dim etiq As String

For i = 1 To 42
etiq = "lbl" & i
Set lbl = frmCalendario.Controls.Item(etiq)
Set newLabel(i) = New clsLabel
Set newLabel(i).myLabel = lbl
Next i
End Sub

And ... it works!!!!!
Thread Tree
GideonOmega Creating an Event handler on 6 Dec 2005 at 1:31 PM
PavlinII Re: Creating an Event handler - bad news on 16 Dec 2005 at 1:36 PM
GideonOmega Re: Creating an Event handler - bad news on 17 Dec 2005 at 4:41 PM
DougieW Re: Creating an Event handler - bad news on 6 Jun 2009 at 7:01 AM
izthar Re: Creating an Event handler - bad news on 4 Mar 2012 at 12:14 PM
izthar Re: Creating an Event handler - bad news on 4 Mar 2012 at 12:16 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.