|
|
|
|
how to Pass Optional Parameters in VBS?
|
|
04-06-2011, 07:25 PM
Post: #1
|
|||
|
|||
|
Hi, We can't use optional parameter in vbs like we can in VB as follow: InsertRecord "Read" Public Function InsertRecord(Optional sLogMsg = "Write") ValidateRecord(sLogMsg ) End Function Please provide me an effective solution which will not lead to any major code change! I am having following option but avoiding because of the "scope" of variable declared for Optional parameter: ![]() Ex. mymessage = "OPTIONAL" 'sDelimiter = | Call ABC("asdf", mymessage) 'sDelimiter = | - DEFAULT Call ABC("asdf", "12345") 'Override Delimiter = '$' Public Function ABC(str, mymessage) ' OptionaL values in function arguments If mymessage = "OPTIONAL" Then mymessage = "123" End If Msgbox mymessage End Function |
|||
|
06-13-2011, 03:12 AM
Post: #2
|
|||
|
|||
|
RE: how to Pass Optional Parameters in VBS?
Simple, use dictionaries from a string (example not functioning code)
call X("param1::value1^^param2::value2") function X(aDict) dict = call decodeDict(aDict) if dict("param1") <> "" then pm1 = dict("param1") else pm1 = "" OR make all passable parameters global ( not recomended ) Of cause how you break up the dict and return it I leave to you (04-06-2011 07:25 PM)ShrikantBiradar3449 Wrote: Hi, |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| optional parameters | Ishul | 4 | 284 |
04-03-2012 11:18 PM Last Post: supputuri |
|
| Pass "/" in Query string to DB | Anjali09 | 0 | 256 |
01-04-2012 08:34 PM Last Post: Anjali09 |
|
| VBS to DLL to QTP | ssco77 | 5 | 3,122 |
12-16-2011 01:21 PM Last Post: prashants1 |
|
| Exception handler parameters | Ashok Kumar | 1 | 347 |
12-09-2011 10:23 PM Last Post: supputuri |
|
| how to pass an integer array variable in a query | sujaravi123 | 1 | 566 |
10-28-2011 01:44 PM Last Post: ravi.gajul |
|
User(s) browsing this thread: 1 Guest(s)
|
|

Search
Member List
Calendar
Help




