| Author |
Topic Search Topic Options
|
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Topic: Multiple Handles in sub Posted: 01 November 2003 at 2:10pm |
Hey,
I want a single sub to take care of all the links in a page, by using
Private Sub Links(..) Handles Link1.Click, Link2.Click
How am I going to know in the sub wich link the user pressed? I can make seperate subs, but I wanted to know if I can do it like this. So, can I?
|
|
Gone..
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 01 November 2003 at 4:46pm |
i wouldnt think thats possible, as the sub would have absolutely no idea what they clicked...
just save yourself time and write seperate functions (after all, if you want to know which is click, then you must be wanting to do different things)
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 01 November 2003 at 5:37pm |
Are you sure? In VB6 (a long time ago..) they had things like If Case = "" and stuff. Is that completely gone in .NET?
I'm not sure. I'll keep trying, but idd, I already created seperate subs, wich is nog a big deal, but still, it supports multiple handles, so it must SOMEHOW know wich link is pressed.
|
|
Gone..
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 01 November 2003 at 7:15pm |
just go with what works.. you said you already have seperate subs... do it...
and yes, VB.NET suppurts SELECT CASE
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
|
Post Options
Thanks(0)
Quote Reply
Posted: 02 November 2003 at 3:45am |
Can't you index controls so it would be something like
Private Sub Link_Click(Index As Integer) Handles link.click
Mart.
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 02 November 2003 at 4:24am |
Uhh, no. It must always look like this
Private Sub Link_Click(sender As System.Object, e As System.Eventargs) Handles link.click
That's because the framework always sends those values, and it will result in an error if you don't have a sub looking like this..
|
|
Gone..
|
 |
Mart
Senior Member
Joined: 30 November 2002
Status: Offline
Points: 2304
|
Post Options
Thanks(0)
Quote Reply
Posted: 02 November 2003 at 9:35am |
yea i know i couldnt be bothered writin all that out, like this then:
Private Sub Link_Click(Index As integer, sender As System.Object, e As System.Eventargs) Handles link.click
And on the links put Index="0" etc. Does that work?
Mart.
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 02 November 2003 at 12:27pm |
|
I don't think so, since you can't tell wich stuff should be send to the sub when it is clicked, since the framework does that. Or I would have to crack the framework and stuff, but thats a bit to much I guess.
|
|
Gone..
|
 |