passing array as parameter to activex component
Author |
Message |
Jeff Watts-Ro #1 / 12
|
 passing array as parameter to activex component
I have a page where check boxes are created dynamically and named individually. After I parse these to see if they are checked, I add the number of each into an array (e.g. strIDs). I send this array to an object that I create within the page, that is, I pass the array as a parameter, then the activex dll moves through each and does certain database tasks. At least that is how it is supposed to work. I have not been able to get my component to accept an array as a parameter. I have dimensioned it every way imaginable, as well as the output of the function. Nor have I found any sample code out there to do this. Any suggestions? Thanks in advance, Jeff W-R -- Jeff Watts-Roy, MCP
|
Sun, 19 May 2002 03:00:00 GMT |
|
 |
Michael Harri #2 / 12
|
 passing array as parameter to activex component
The component method needs to define the argument (in VB-speak) As Variant (which will contain an array of variants of subtype "string"). -- Michael Harris
I have a page where check boxes are created dynamically and named individually. After I parse these to see if they are checked, I add the number of each into an array (e.g. strIDs). I send this array to an object that I create within the page, that is, I pass the array as a parameter, then the activex dll moves through each and does certain database tasks. At least that is how it is supposed to work. I have not been able to get my component to accept an array as a parameter. I have dimensioned it every way imaginable, as well as the output of the function. Nor have I found any sample code out there to do this. Any suggestions? Thanks in advance, Jeff W-R -- Jeff Watts-Roy, MCP
|
Sun, 19 May 2002 03:00:00 GMT |
|
 |
Jeff Watts-Ro #3 / 12
|
 passing array as parameter to activex component
OK, since I have no idea what you just said, I will show you some of my code. Is it because the array is named differently for each? [strRecs() vs. strIDs()] Here is the function (first line): Public Function ApproveBatch(ByVal wUser, strRecs(), ByVal wNumToApprove) As Variant And here is the call from within the ASP: result = mySirEdit.ApproveBatch(wUser, strIDs(), intNums ) -- Jeff Watts-Roy, MCP
The component method needs to define the argument (in VB-speak) As Variant (which will contain an array of variants of subtype "string"). -- Michael Harris
I have a page where check boxes are created dynamically and named individually. After I parse these to see if they are checked, I add the number of each into an array (e.g. strIDs). I send this array to an object that I create within the page, that is, I pass the array as a parameter, then the activex dll moves through each and does certain database tasks. At least that is how it is supposed to work. I have not been able to get my component to accept an array as a parameter. I have dimensioned it every way imaginable, as well as the output of the function. Nor have I found any sample code out there to do this. Any suggestions? Thanks in advance, Jeff W-R -- Jeff Watts-Roy, MCP
|
Sun, 19 May 2002 03:00:00 GMT |
|
 |
Michael Harri #4 / 12
|
 passing array as parameter to activex component
Public Function ApproveBatch(ByVal wUser, strRecs, ByVal wNumToApprove) As Variant Since strRecs is now a Variant, _anything_ could be passed, so if you want to "play it safe"... If Not IsArray(strRecs) Then ExplodeIntoMillionsOfTinyLittlePieces() -- Michael Harris
OK, since I have no idea what you just said, I will show you some of my code. Is it because the array is named differently for each? [strRecs() vs. strIDs()] Here is the function (first line): Public Function ApproveBatch(ByVal wUser, strRecs(), ByVal wNumToApprove) As Variant And here is the call from within the ASP: result = mySirEdit.ApproveBatch(wUser, strIDs(), intNums ) -- Jeff Watts-Roy, MCP
The component method needs to define the argument (in VB-speak) As Variant (which will contain an array of variants of subtype "string"). -- Michael Harris
I have a page where check boxes are created dynamically and named individually. After I parse these to see if they are checked, I add the number of each into an array (e.g. strIDs). I send this array to an object that I create within the page, that is, I pass the array as a parameter, then the activex dll moves through each and does certain database tasks. At least that is how it is supposed to work. I have not been able to get my component to accept an array as a parameter. I have dimensioned it every way imaginable, as well as the output of the function. Nor have I found any sample code out there to do this. Any suggestions? Thanks in advance, Jeff W-R -- Jeff Watts-Roy, MCP
|
Sun, 19 May 2002 03:00:00 GMT |
|
 |
Jeff Watts-Ro #5 / 12
|
 passing array as parameter to activex component
Ok, this certainly helped. At least now the component is being allowed to process the information. The VBScript runtime error I am getting now says: Microsoft VBScript runtime error '800a000d' Type mismatch: 'ApproveBatch' /issues/sir_approve.asp, line 61 So I guess the function is not returning a variant after all? Thanks, Jeff
|
Sun, 19 May 2002 03:00:00 GMT |
|
 |
Michael Harri #6 / 12
|
 passing array as parameter to activex component
Take the ()s off StrIDs... result = mySirEdit.ApproveBatch(wUser, strIDs, intNums ) -- Michael Harris
Ok, this certainly helped. At least now the component is being allowed to process the information. The vbscript runtime error I am getting now says: Microsoft VBScript runtime error '800a000d' Type mismatch: 'ApproveBatch' /issues/sir_approve.asp, line 61 So I guess the function is not returning a variant after all? Thanks, Jeff
|
Sun, 19 May 2002 03:00:00 GMT |
|
 |
Jeff Watts-Ro #7 / 12
|
 passing array as parameter to activex component
Ok, I did this, and like I said, the DLL is actually doing the processing, but I am not getting a result. Here is the current code: Public Function ApproveBatch(ByVal wUser, strIDs() As Variant, ByVal wNumToApprove) As Variant The function ends with: If strResult = "" Then ApproveBatch = "Something went wrong" Else ApproveBatch = strResult End If myResult = mySirEdit.ApproveBatch(wUser, strIDs, intNums) I don't get a result or "Something went wrong" message Thanks, Jeff
|
Mon, 20 May 2002 03:00:00 GMT |
|
 |
Michael Harri #8 / 12
|
 passing array as parameter to activex component
Any chance that (within ApproveBatch) strResult contains only one or more spaces? Try: If trim(strResult) = "" then ... -- Michael Harris
Ok, I did this, and like I said, the DLL is actually doing the processing, but I am not getting a result. Here is the current code: Public Function ApproveBatch(ByVal wUser, strIDs() As Variant, ByVal wNumToApprove) As Variant The function ends with: If strResult = "" Then ApproveBatch = "Something went wrong" Else ApproveBatch = strResult End If myResult = mySirEdit.ApproveBatch(wUser, strIDs, intNums) I don't get a result or "Something went wrong" message Thanks, Jeff
|
Mon, 20 May 2002 03:00:00 GMT |
|
 |
Jeff Watts-Ro #9 / 12
|
 passing array as parameter to activex component
I just tried this, an no, that is not the case. I put code in the DLL to write some events to a text log, just to make sure it was getting ready to return a result and it didn't even start the process, which leads me to believe that once again, the 'Type Mismatch' is originating with the call to the DLL. I have tried all sorts of dimensioning scenarios, but still I get a type mismatch. Is it even possible to do this? Have I been wasting two days on something that can't be done? At this point I am ready to just pass a long string and parse it within the DLL. Any last thoughts on this? Jeff
|
Mon, 20 May 2002 03:00:00 GMT |
|
 |
Michael Harri #10 / 12
|
 passing array as parameter to activex component
Is this still how the method is defined? Public Function ApproveBatch(ByVal wUser, strIDs() As Variant, ByVal wNumToApprove) As Variant It should be defined this way: Public Function ApproveBatch(ByVal wUser, strIDs As Variant, ByVal wNumToApprove) As Variant And called like this: result = mySirEdit.ApproveBatch(wUser, strIDs, intNums ) where strIDs is the array name: Dim strIDs() 'and later ReDim'd Dim strIDs 'and later ReDim'd or set with "strIDs = Array("blah","blah2",...) -- Michael Harris
I just tried this, an no, that is not the case. I put code in the DLL to write some events to a text log, just to make sure it was getting ready to return a result and it didn't even start the process, which leads me to believe that once again, the 'Type Mismatch' is originating with the call to the DLL. I have tried all sorts of dimensioning scenarios, but still I get a type mismatch. Is it even possible to do this? Have I been wasting two days on something that can't be done? At this point I am ready to just pass a long string and parse it within the DLL. Any last thoughts on this? Jeff
|
Mon, 20 May 2002 03:00:00 GMT |
|
 |
Ashish Mathu #11 / 12
|
 passing array as parameter to activex component
Read the whole exchange ! You prpbably need to register your component using a registry file that contains... ---- REGEDIT4 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\ADCLa unch\dllName.ClassName] HTH, Ashish
|
Tue, 21 May 2002 03:00:00 GMT |
|
 |
Jeff Watts-Ro #12 / 12
|
 passing array as parameter to activex component
Michael, Thanks! At some point I put code in changing the return value of the function to Long. I changed it back to variant and made sure it looked like what you recommended, and it is working perfectly. Thanks for your persistence in this matter--I appreciate it! Jeff Watts-Roy -- Jeff Watts-Roy, MCP
|
Tue, 21 May 2002 03:00:00 GMT |
|
|
|