Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Pass by Reference Functions

Status
Not open for further replies.

snoopdd

Vendor
Feb 22, 2005
3
US
I'm converting some Visual Basic GUI programs into VBScript command line tools to test the availability of remote application servers.

I'm having trouble getting VBScript to handle a function that includes 3 'pass by reference' arguments, which the function updates with return information.

The Visual Basic code looks like this:
=========================================================
Dim bankLogonObject As Object

Dim retVal As Integer
Dim accountList As String
Dim responseCode As String
Dim classOfService As String

Set bankLogonObject = CreateObject("BankLogon.Logon")

'
' These arguments come from GUI text fields
'
' jobId, serverNumber, origID, userId, bankId, userPassword

retVal = bankLogonObject.ValidateLogon(jobId, serverNumber, origID, userId, bankId, userPassword, classOfService, accountList, responseCode)
=========================================================

I've made a VBScript that looks like this:
=========================================================
Dim bankLogonObject

'
' These arguments come from the command line
'
' jobId, serverNumber, origID, userId, bankId, userPassword

Set bankLogonObject = CreateObject("BankLogon.Logon")

set retVal = bankLogonObject.ValidateLogon(jobId, serverNumber, origID, userId, bankId, userPassword, classOfService, accountList, responseCode)


WScript.StdOut.WriteLine "retVal=" & retVal
WScript.StdOut.WriteLine "responseCode=" & responseCode
=========================================================

However, when I run it (on Windows NT4), I get:

=========================================================
C:\> cscript appTest.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

appTest.vbs(17, 1) Microsoft VBScript runtime error: Type mismatch: 'ValidateLogon'
=========================================================

I've tried all sorts of syntax combinations, but cannot get it to work - any ideas?
 
try removing the 'set in :

set retVal = bankLogonObject.ValidateLogon(...)

Hope this does the trick...


--------------------------------------
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top