Hi All!
##### I have a class clsQProductItem with function GetAllFromInvoice:
Friend Function GetAllFromInvoice(ByVal Invoice As String) As
clsQProductItem()
' Dim retObject() As clsQProductItem = New
clsQProductItem
Dim DataConn As New DataConn
Dim DT As New DataTable
Dim iRowNum As Integer
'Step1: Get all productItems belonging to Invoice
Try
DT = DataConn.RunCmd("Select * from '" & TableName & "'
where invoice = '" & Invoice & "'")
Dim retObject(DT.Rows.Count) As clsQProductItem
'retObject = New clsQProductItem
While Not (DT.Rows(iRowNum).HasErrors)
With retObject(iRowNum)
.ProductItemID =
DT.Rows(iRowNum).Item("ProductItemID").ToString
.Product =
DT.Rows(iRowNum).Item("Product").ToString
.Invoice = Invoice
.Quantity =
DT.Rows(iRowNum).Item("Quantity").ToString
End With
iRowNum += 1
End While
Return retObject
Catch ex As Exception
EventLog1.WriteEntry("Error in cls" & TableName &
".GetAllFromInvoice: " & ex.Message)
End Try
End Function
###### Trying to call this function from a Form:
Dim QProd() As clsQProductItem = New clsQProductItem() {}
QProd = DirectCast(QProd.GetAllFromInvoice(CurrentQinvoice ),
clsQProductItem())
###### I get a squiggly line with message 'GetAllFromInvoice' is not a
member of 'System.Array'
###### Tried this also, gives same error
Dim QProd() As clsQProductItem = New clsQProductItem() {}
QProd = QProd.GetAllFromInvoice(CurrentQinvoice)