How to pass Array in ASP to VB COM DLL

Results 1 to 4 of 4

Thread: How to pass Array in ASP to VB COM DLL

  1. #1
    Dilip Guest

    Default How to pass Array in ASP to VB COM DLL

    Could anyone tell me how to pass Array in ASP to call VB DLL Function. In VB DLL Function the parameter type is Array of String. The Error generate in my ASP Code (Error : Type mismatch at "If User_Info.DeleteUserInDatabase(aryUserName) = True then")<BR><BR><BR>My Code is as follows:<BR>&#060;%<BR>If Request.QueryString("Search") = "Delete" then<BR><BR>Dim strDelete_UserName<BR>Dim intLoop<BR>Dim strArray<BR>Dim aryUserName()<BR>ReDim aryUserName(cint(Request.QueryString("No_Delete")) )<BR>strArray = Request.QueryString("Delete_UserName")<BR>aryDelet e_UserName = Split(strArray,",")<BR>for intLoop = LBound(aryDelete_UserName) to UBound(aryDelete_UserName)<BR>aryUserName(intLoop) = Trim(aryDelete_UserName(intLoop))<BR>next<BR>Set User_Info=server.CreateObject("mWizardManagementTo ol.AddNewUser")<BR>If User_Info.DeleteUserInDatabase(aryUserName) = True then<BR><BR>%&#062;<BR><BR>VB DLL Function is :<BR><BR>Public Function DeleteUserInDatabase(MyArray() as String) As Boolean<BR>MYCODE GOES HERE<BR>End Function<BR><BR><BR>*** Thanks in advance

  2. #2
    RDM Guest

    Default Variants

    Either Cstr(aryDelete_UserName) during the function call or change your DLL to have the array be a Variant.<BR><BR>Also, for performance reason, store the values of LBound(aryDelete_UserName) and UBound(aryDelete_UserName) in local variables and use those in your loop. You don&#039;t want the loop to recalculate the LBound and Ubound everytime when it is unnecessary. Small arrays not a big problem, larger ones definitely are...

  3. #3
    Dilip Guest

    Default RE: How to pass Array in ASP to VB COM DLL

    Well, the aryUserName has the collection of elements. I want to pass this to my DLL Function (DeleteUserInDatabase(Myarray() as String))<BR><BR>I did changed my DLL Function paramer as variant but it didn&#039;t work.<BR><BR>Help appreciated

  4. #4
    RDM Guest

    Default Closer look..

    Upon looking at this closer, I&#039;m pretty sure you have to pass the array with the () as well. I&#039;ve got several DLL&#039;s that pass arrays in this manner.<BR><BR>User_Info.DeleteUserInDataBase(aryU serName())

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts