|
-
Nov 13th, 2005, 06:25 PM
#1
Thread Starter
Addicted Member
[Resolved]Dynamically adding event args?
Hello,
If someone could point me in the right direct for this one, I would be jump up and down with joy, proclaiming your handle at the top of my lungs!
Now, on to the question: Is there a way to add event args dynamically. Here's what I mean:
I create a picturebox, and add it to a panel on the fly. I want it to be able to drag and drop. Also, I to create pictureboxes with onDragEnter do this, but because this is all dynamically created, I have no clue how to do this...
:-(. If I haven't explained clearly, plz let me know and I'll get into it more.
Thanks,
Mike
Last edited by spelltwister; Nov 16th, 2005 at 08:15 PM.
-
Nov 13th, 2005, 06:27 PM
#2
Re: Dynamically adding event args?
Check out the AddHandler method. You can write a generic sub that covers all the particular ondrag events for pictureboxes, and then use the sender variable to perform the sub's action on your specific picturebox.
Bill
-
Nov 14th, 2005, 04:16 AM
#3
Thread Starter
Addicted Member
Re: Dynamically adding event args?
I hate to ask, but can you give me an example of how this works, something simple like if i drag a little square into a large circle it pops a messagebox("CIRCLE!!!") and if i drag it to the triangle it pops a messagebox("TRIANGLE!!!"). That would help me soo much! Thanks!
-
Nov 14th, 2005, 04:19 AM
#4
Re: Dynamically adding event args?
Hmm, that's not exactly a "Simple Example" 
An Excellent example of how to add event handlers at runtime is available in the 101 VB.Net Examples at the top of this forum. Check out "Dynamic Control Creation"
Bill
-
Nov 14th, 2005, 10:56 PM
#5
Thread Starter
Addicted Member
Re: Dynamically adding event args?
Thanks, I'm checkin' out these examples and hopefully I can figure something out from them! THANKS SOO MUCH!!!
Mike
-
Nov 16th, 2005, 08:15 PM
#6
Thread Starter
Addicted Member
Re: Dynamically adding event args?
conipto is officially my hero!!! that worked great, you have no idea how greatful I am... YOU RULE!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|