event inheritance


I am writing class that wraps aroung a form that has a few buttons.  How do I access the events from the class?  What I want to do is to implement the events from the class instead of the form.  The reason for it to be done this way is that I have some public variables in the class that I need to use within the events.  I don't know how to feed these variables to the form.  Thus, the only way I could think of is to implement the events such as button_click() within the class.  But how?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could you not wirte code on the click of the button calls the click_event within your class?


Public sub Command1_click()
end sub

This would assume that you have your class intanciated of course.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Let's work with one event here,

In your class define Click as event like this

Public Event Click()

now in the form_click() event in your calss do this

RaiseEvent Click()

now in your client wihich uses this class,

decalre the variable of the class like this,

Private WithEvents vmyClass As myClass

This will put myClass_Click() event automatically in the code, you can do whatever here (this will be raised when form_click() event occurs...

hope this helps you...
gamestorsAuthor Commented:

Both answers work!!!So i am going to credit the first answer.  Thanks to both.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.