vbScript - Using Select/Case with an array -
i need following:
dim reportesta(2) reportesta(0) = "report1" reportesta(1) = "report2"
i want execute actions each item in array list. thinking of working select/case. tried didn't work:
select case reportesta case 0 //do stuff case 1 //do stuff end select
is there way cases switch? switch/case? has better way work each item of array? much.
dim reportesta(2) reportesta(0) = "report1" reportesta(1) = "report2" = lbound(reportesta) ubound(reportesta) select case reportesta(i) case "report1" msgbox "report1" case "report2" msgbox "report2" end select next
explanation:
in "for" cycle passing through of elements in array, starting first 1 till last one.
function "lbound" return lowest id of available element in array.
function "ubound" return highest id of available element in array.
in "select case" taking value (yes, has string type) of element array , making decision should -- in sample popup message box displaying report name.
Comments
Post a Comment