[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

event inheritance

Hi,

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?
thanks
Gamestors
0
gamestors
Asked:
gamestors
1 Solution
 
tkuppinenCommented:
Could you not wirte code on the click of the button calls the click_event within your class?

ie.

Public sub Command1_click()
    class.click_envent
end sub

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


0
 
manojaminCommented:
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...
0
 
caraf_gCommented:
Yep.
0
 
gamestorsAuthor Commented:
Hi,

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


Gamestors
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now