Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Which approach is better

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61374
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Which approach is better
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Which approach is better - 6/15/2008 11:15:25 AM   
  shahid09

 

Posts: 41
Score: 0
Joined: 1/22/2007
Status: offline
Hi All,

I have one ActionCanExecute() function which is provided by the tool and triggers this action when user perform any action in the tool. My question is which approach is better?

1. In ActionCanExecute() use SELECT statement for each action and create / call function / sub within Actioncanexecute()

e.g

      

2. In ActionCanExecute() use SELECT statment for each action and create function/sub outside of the Actioncanexecute() and called from actioncanexecute() and called function stored in actioncanexecute which returns true / false.

e.g


      


3. In ActionCanExecute() use SELECT statement and execute block of code right after each case in the structure

e.g


      


Can anyone please guide me which approach is better 1 or 2 or 3
1. Call function/sub within ActionCanExecute()      'Here we return ActionCanExecute from function/sub 
2. Call function/sub outside of ActionCanExecute()  'Here we return ActionCanExecute by calling function/sub
3. Write code without creating function/sub          'Here we return ActionCanExecute after each block of code within case statement


Thanks,
Shahid Khan
 
 
Post #: 1
 
 RE: Which approach is better - 6/15/2008 5:26:36 PM   
  ehvbs

 

Posts: 2065
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi shahid09,

you can't nest Subs/Functions in VBScript. Whether to do the work inline in ActionCanExecute()
or in extra Functions/Subs depends on the size of the code (will ActionCanExecute() get so big/long
that it isn't easy to read/understand) and on the number of calls to those functions.

Regards

ehvbs

(in reply to shahid09)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Which approach is better Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts