Results 1 to 2 of 2

Thread: Add a subroute to multiple forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Location
    Missouri
    Posts
    69

    Add a subroute to multiple forms

    I'm trying to find a way to add a subroutine to multiple forms in VB.net 2k5.

    I'm instancing some forms as a property of a class and I need an event that triggers to handle their .dispose property.

    I think that's the proper way to describe it. I'm a bit of a noob. Just in case that's not understandable, I'll break it down a bit more below.

    I have a public class which contains "Public Myform as Object".
    There is are a number of inherited classes which contain "Myform = new (appropriate form)".
    When the instance of the form is disposed, I'd like to trigger an additional event.

    I can go into each form and add the event, but to keep modification simple, I was hoping there was a way I could create a "handles Myform.dispose" from within the main public class, since it will be the same for all of the various forms that will be loaded.

    Initially, I tried using "Public Myform as Form" but because the inherited classes have overloaded events which call properties of their specific form this doesn't seem to work.

    Any suggestions?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Location
    Missouri
    Posts
    69

    Re: Add a subroute to multiple forms

    What I've done is to add a public sub in a module and added a call statement to the .disposed handler of each of the forms in question.

    It works well for consolidating the code into one place for updates, but I'm still looking for a way to add this code dynamically to the form from within the class if anyone has any thoughts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width