VB.Net 2-d array question

Results 1 to 2 of 2

Thread: VB.Net 2-d array question

  1. #1
    Join Date
    Dec 1969

    Default VB.Net 2-d array question

    I have the following codes in my .aspx page that passes a 2-d array to a COM object.<BR><BR>...<BR>Dim arrArray(,) As Object = New Object(intCounter - 1, 5) {}<BR>For Each item In upl.Form<BR> ...<BR> &#039;store values in array<BR> arrArray(intNumber, 0) = FormatDateTime(Now, vbGeneralDate)<BR> arrArray(intNumber, 1) = ID<BR> arrArray(intNumber, 2) = filename<BR> arrArray(intNumber, 3) = FormatDateTime(Now, vbGeneralDate)<BR> arrArray(intNumber, 4) = upl.Form(item).TotalBytes<BR> arrArray(intNumber, 5) = strTempFolder<BR> intNumber = intNumber + 1<BR>Next<BR><BR>Try<BR> Dim obj As New KeepTrackOfUploads.UpdateUploadLogClass()<BR> obj.UpdateUploadLog(arrArray)<BR>Catch<BR> Response.Write(Err.Source & " , " & Err.Description)<BR>End Try<BR><BR>This is from my .dll written in VB 6:<BR>Public Sub UpdateUploadLog(ByRef varListOfFile() As Object)<BR> Dim intArraySize As Long<BR> Dim intI As Integer<BR> intArraySize = UBound(varListOfFile)<BR> On Error GoTo OpenConnection_EH<BR> <BR> For intI = 0 To intArraySize<BR> Call RunTheUpdate(varListOfFile(intI, 0), varListOfFile(intI, 1), varListOfFile(intI, 2), varListOfFile(intI, 3), varListOfFile(intI, 4), varListOfFile(intI, 5))<BR> Next<BR>Exit Sub<BR>OpenConnection_EH:<BR> Err.Raise 123456789, "UpdateUploadLog", Err.Description<BR> <BR>End Sub<BR><BR>I got the COM ready for use in my asp.net. In fact, when I comment out the "obj.UpdateUploadLog(arrArray)" I don&#039;t get an error. But when I uncomment that line out I get an error "Interop.KeepTrackofUploads , Expected array was not of the specified type". I don&#039;t know what to do. I think I&#039;d have to rewrite the dll, but don&#039;t know how. I am able to reference the individual members of the array in my aspx page.<BR><BR>Pls help.

  2. #2
    Join Date
    Dec 1969

    Default Stab in the dark

    My guess would be that your creating a string array and it is expecting an int array or something along those lines.

Posting Permissions

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