The Functions are returning zero, but that's a whole different issue

I Just did a Dim Array(-10 to -1) and it liked it, I guess it has to increment to the right...
Thanks!
Scott
-------------
Scott Turchin
%INVALID_KEY = -1 %INVALID_PARAM = -2 %MODEM_NOT_RESPONDING = -3 %DIALCMD_DIDNOTECHO = -4 %NOCONNECT_AFTERDIAL = -5 %NETWORK_NOTUP = -6 %NETWORK_DIDNOTRESPOND = -7 %TRANSACTION_GARBLED = -8 %PORT_NOT_INITIALZIED = -9 Each Function is depending on the previous function before it is SUPPOSED to function, so I need to store each return for each function in an array: Function InitDLL() as long Dim MsgArray(1 To 10) As Long Dim MsgStArray(1 To 10) As String Local x As Long Now, I make a function call (1 of 10): Incr x '1) Key = "Reset":Param = "" lResult = FreeCCSDLL(Key,Param) MsgArray(x) = lResult MsgStArray(x) = ErrToString(MsgArray(x)) Incr x So now i have an INTEGER/LONG return code and a corresponding STRING value. Life is good, except the return code is negative, and if the function returns a 1 then it succeeded, 0 if it fails. So I want to add up which one's failed in an array of MsgStArray() but want to keep the numeric in MsgArray(). I thought I had this working once, but it is best to keep the return values in negative connotation, or I can use ABS to convert, but then if the function succeeds it will seem as an error... '------------------------------------------------------------------------------ Function ErrToString(ByVal ErMsg As Long) As String Dim MsgStr(0 To 10) As String Here is the problem, the array can't be dimmed as -1 to -10, or can it? 'DLL Error codes MsgStr(0) = "Function Failed" MsgStr(%INVALID_KEY) = "Invalid Key on Function " '-1 for real, converted to abs is 1, so incr instead MsgStr(%INVALID_PARAM) = "Invalid Parameter" MsgStr(%MODEM_NOT_RESPONDING) = "Modem Not Responding" MsgStr(%DIALCMD_DIDNOTECHO) = "Dial Command did not echo" MsgStr(%NOCONNECT_AFTERDIAL) = "No connection after dialing" MsgStr(%NETWORK_NOTUP) = "Credit Card Network is not up" MsgStr(%NETWORK_DIDNOTRESPOND) = "Credit Card Network did not respond" MsgStr(%TRANSACTION_GARBLED) = "Transaction was garbled" MsgStr(%PORT_NOT_INITIALZIED) = "Com Port did not initialize Function = MsgStr(ErMsg) Erase MsgStr End Function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: