Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Multiple Handles in sub
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple Handles in sub

 Post Reply Post Reply Page  12>
Author
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.