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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Raising Events

Status
Not open for further replies.

LegoPiece

Programmer
Mar 19, 2001
95
US
Is it possible to raise an event from a class module then receive it in a form module???

E.g.

Class module Thing:
-------------------
Public Event Ding(DingValue as Integer)

Public Property Let Value (SomeValue as Integer)
RaiseEvent Ding(SomeValue + 10)
End Property

Form Module frmMain:
--------------------

Private MyThing as new Thing

Private Sub Form_Load()
MyThing.Value = 18
End Sub


Now... let's say I have a textbox, where I want to display the value returned to me via the event 'Ding' (in this case 28). Erm... how would I write this in the Form module code?

Any Thoughts? (I'll be happy to clarify further, if required!)


Peace
Lego

"I don't think we have the right or the wisdom to interfere with an alien tribe no matter how it's evolving!" - Captain James T. Kirk

"Your people must embrace these words and the words that follow, for their true meanings are..." - Captain James T. Kirk (same episode)
 
At a quick glance this

Private MyThing as new Thing

need to be

Dim WithEvents MyThing as Thing

Then

Private Sub Form_Load()
Set MyThing = New Thing
End Sub


Private Sub Thing_Ding(DingValue as Integer)
'What ever goes here
End Sub


Hope this helps If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
Cool... I'll mosey on down to my lab, try it out + let you know how it worked out. Thanks a billion for your help! Peace
Lego

"I don't think we have the right or the wisdom to interfere with an alien tribe no matter how it's evolving!" - Captain James T. Kirk

"Your people must embrace these words and the words that follow, for their true meanings are..." - Captain James T. Kirk (same episode)
 
Oops

This is correct

Private Sub MyThing_Ding(DingValue as Integer)
'What ever goes here
End Sub If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
Heh - don't worry about that, I caught it, but the concept was there and I thank you very much for it! The important thing is... IT WORKED! Yay! Peace
Lego

"I don't think we have the right or the wisdom to interfere with an alien tribe no matter how it's evolving!" - Captain James T. Kirk

"Your people must embrace these words and the words that follow, for their true meanings are..." - Captain James T. Kirk (same episode)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top