CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2008
    Posts
    45

    AddressOf Button

    Hi Guys,
    I have made a class which creates a button depending on what data i send to the sub.
    When i send the information, eg: Name, Text, etc, I give it a string which i want to be the addressOf the created button for example

    Dim ButtonClickEventSub as string ' Similar variable is brought in

    AddHandler ButtonObject , AddressOf ButtonClickEventSub 'This doesn't work but is sort of what i want.

    Unfortunately the sub is also in the form so i think it needs to be reference some how like: Form1.ButtonClickEventSub


    Thanks in advance
    Chris

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: AddressOf Button

    Bad design. A class shouldn't know about anything outside of itself. Move the sub to the class, and load a dummy value, maybe.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Featured