Announcement

Collapse
No announcement yet.

VBScript - Writing Func/Sub that can take 0 or 1 args?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBScript - Writing Func/Sub that can take 0 or 1 args?

    I was wondering if there was some way that I can write a function or sub that can be called with or without arguments?

    I specifically want to be able to write a func/sub that can either accept 1 or 0 arguments and then handle that inside the func/sub to respond differently.

    I suspect that the best I can do is pass in an empty string, but I'd be happy to hear anyone's wisdom on this?

  • #2
    Re: VBScript - Writing Func/Sub that can take 0 or 1 args?

    You are not alone it seems:
    Try this solution
    http://www.4guysfromrolla.com/webtech/071801-1.shtml
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: VBScript - Writing Func/Sub that can take 0 or 1 args?

      thanks for the link, it seems that the easier of the two approaches is the null based approach which is basically the same as me passing in an empty string and testing for that.

      Comment


      • #4
        Re: VBScript - Writing Func/Sub that can take 0 or 1 args?

        The name fro what you are searching for is "Polymorphism" (which vbscript doesn't support)

        You can try this link for a workaround : http://www.nsbasic.com/desktop/info/technotes/TN29.htm

        Comment

        Working...
        X