redim in a web service with arrayed structors/"Redim statement requires Array"

D

Daryl Davis

I am having trouble with ReDim (see code below)

SaleTable2's structure includes an array for SaleDetailTable2
Dim newsale As New hallsales.SaleTable2
Dim detail As New hallsales.SaleDetailTable2

Try

redim newsale.SaleDetails(0) ********* This line comes out with an error
"Redim statement requires Array" *************

newsale.SaleDetails(0) = detail

a = obj.SellFromPOS(newsale, bcomplete)

Catch ex As Exception

End Try

Is there a way through or around this problem?

Daryl Davis
 
C

Cor

Hi Daryl,

As soon as you needs redim, you can better look at the arraylist.
The array is not efficient.

My advice have a look at what the "arraylist" can do for you first.
And if it there something you do not understand, ask it in this thread
again.

I hope this helps,

Cor
 
D

Daryl Davis

Cor,
I don't think the arraylist will help me. Let me try to explain myself
again, for last night I was extreemly fustrated....
I have vb6 dlls already built and running. I am going to try to access
these dlls through a websevice so that I can access them from remote units
(CE.net). All this webservice is new to me so please bear with me, I am
learning it as fast as I can.
The following Types are in the vb6 dll.

Public Type SaleDetailTable
ProductID As Long
ProductQty As Integer
ProductAmt As Single
TaxableItem As Integer
PointsUsed As Integer
DiscountAmt As Single
ProductCharge As Single
IsElecBingo As Boolean
End Type

Public Type SaleTable
SaleID As Long
ticketnumber As Long
acctticket As Long
SellDate As Date
SessionDate As Date
Session As Integer
posStation As Integer
UserID As Long
CreditAmt As Single
ProductAmt As Single
TaxAmt As Single
DiscountAmt As Single
PointsUsed As Integer
PointsEarned As Integer
MemberID As Long
voided As Integer
SaleClosed As Integer
SaleFinalized As Integer
SaleDetails() As SaleDetailTable
End Type

Simple enough, I can access the web service via the smartdevice. (thanks
to other peoples newsgroups postings I was able to figure this out)
Now as you see at the end of the SaleTable Type, SaleDetails is an array. I
belive that I am recieving a nullexception error when I call my web service
because of this... Or I may be in the completly wrong ballpark. The redim
line is (example as I am still doing some trial and error)

redim newsale.SaleDetails(4)

The call is simple
a = obj.SellFromPOS(newsale, bcomplete)

where a is an integer return, newsale is a SaleTable, and bcomplete is the
return on if the sale was completed.

The dll is supposed to change ticketnumber from 0 to a 9 diget number.

I hope that this clears up my explanation.
Daryl
 
D

Daryl Davis

I have figured this out.
The only way it seems that I am able to make these changes is if I create a
structure exactly like the vb Type and set it equal
newsale.saledetail = webservicecopy.saledetail

Thank you for your help...
Daryl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top