Home All Groups Group Topic Archive Search About

object does not source automation error

Author
19 Mar 2006 10:16 AM
adzir
hi,

i'm trying to get my image object (clsBitmap) to respond to events,
such as mouseover events, mouseclick events etc

I declared my image object :

dim WithEvents cbImg as clsBitmap

and in the form_load() sub:

set cbSkype = new clsBitmap

when I compiled it I got this error message:

Compile error:object does not source automation events

How can I get this thing correct? Pls show me the way. Thanks

Author
19 Mar 2006 1:44 PM
Norm Cook
That error is raised when you define your class 'withevents' but it
does not raise any events.
Here's a simple class with events & form implementation
'Class1
Option Explicit
Private WithEvents mpb As PictureBox
Public Event PBClick()
Private Sub mpb_Click()
RaiseEvent PBClick
End Sub
Public Property Set PBox(pb As PictureBox)
Set mpb = pb
End Property
'Form1
Option Explicit
Private WithEvents C As Class1
Private Sub C_PBClick()
Debug.Print "pb click"
End Sub
Private Sub Form_Load()
Set C = New Class1
Set C.PBox = Picture1
End Sub

Show quoteHide quote
"adzir" <muad***@yahoo.com> wrote in message
news:1142763389.616012.317920@v46g2000cwv.googlegroups.com...
> hi,
>
> i'm trying to get my image object (clsBitmap) to respond to events,
> such as mouseover events, mouseclick events etc
>
> I declared my image object :
>
> dim WithEvents cbImg as clsBitmap
>
> and in the form_load() sub:
>
> set cbSkype = new clsBitmap
>
> when I compiled it I got this error message:
>
> Compile error:object does not source automation events
>
> How can I get this thing correct? Pls show me the way. Thanks
>