Allow event in form to trigger event in corresponding class module.

  • Thread starter Thread starter GypsyPrince2k
  • Start date Start date
G

GypsyPrince2k

Guest
I'm creating a DLL in VB (Visual Studio 2019). The DLL contains a form (frmForm) that is launched from within a corresponding class module (clsClass).

The DLL is then linked to a client application such as:

Private WithEvents MyObjVar As New clsClass 'Create an instance of the class object within the DLL.

Each time a data item is added to a listbox control on the form it triggers an event called ListAddItem() which is tied to an event handling subprocedure within the form's code.

I need the listbox's event to either be recognized by a client application referencing the DLL or to somehow trigger a separate event within the corresponding class module. Currently, my app can only recognize and therefore handle events which are triggered within the class module. It currently cannot recognize or handle events triggered within the form which is used by the DLL to get user input.

Private Sub MyObjVar_ListAddItem(Sender As Object, Data As EventArgs) Handles MyObjVar.ListAddItem

Recap: I want a form control's event to trigger a custom event in the class module so the client app's code can handle the event.

Any idea(s) on how I might achieve this? While code examples are welcome, a link to an example program, or better yet, a link to some form of documentation regarding this particular task would be greatly appreciated.

Continue reading...
 
Back
Top