Archive for category VBScript

Detecting missing “optional” parameters in VBScript

A bit of nostalgia here- We have some VBScript’s in the system I work on which allow users to modify functionality in the system, and we a number of support functions available to support them. Some of the functions have optional parameters which users pass through with no content- for example in a function called “demo” a user might call “demo 1 , , 5″ leaving the middle parameter blank. This is all fine, unless demo calls another function trying to pass these parameters, in which case you get an error. Turns out it’s actually quite hard to detect these missing parameters- i tried the obvious stuff like testing against Null and Nothing and Empty etc etc but they all broke. In the end I had to use the TypeName() function and test to see if “Error” was returned! Bad times- but here’s the code incase anyone else has to do this…

demo "hi", "shaw" , "test"
demo "hi", , "test"
Sub demo(a, b, c)
  if TypeName(b) = "Error" then
    b = ""
  end if
  MsgBox(a & " " & b & " " & c)
End Sub

No Comments

I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.