Re: help Array with events
Its not an easy solution but it is possible.
See penagates FAQ and code examples on the topic.
http://www.vbforums.com/showthread.php?t=372811
Re: help Array with events
Quote:
Originally Posted by RobDog888
can this be done with an array declared as a picturebox?
perhaps i can just make a new variable that links with the array variable and use events?
sorry I have no knowledge of making variables with events.
Re: help Array with events
I would think so but I didnt write it so I may not be the best to answer you. Perhaps send PG a pm with a link to this thread. ;)
Re: help Array with events
Quote:
Originally Posted by TheUsed
can this be done with an array declared as a picturebox?
Yes: you need to use the second solution (after the divider in that post).
Make an interface class which defines method stubs for every picturebox event which you need to handle. Ensure that each method has an argument which is the reference to a picturebox.
Make a class which contains: (1) a callback property declared using the interface type, which will reference your form, and (2) a reference to a picturebox object declared using WithEvents. In this class, handle each event which you declared in the interface, and in each event handler, call the corresponding method using the callback property you created in (1).
Implement that interface in your form; you can use the picturebox argument of each method to determine where the event was fired from. (Make sure you pass this argument from the event wrapper class!) In the Form_Load event, you can create the array of references to wrapper classes. Set the callback property to 'Me'. This is shown in the FAQ post.
I'd write an example of this exact technique for you, but it's been so long since I used VB6 that I'd get the syntax wrong and mislead you. Hopefully, if you need, someone else can take what I described and create code to do it.
Re: help Array with events
im affraid this is more than I know when it comes to VB6, any way I can get some code examples?