Cannot be converted to '1-dimensional array

jamie_pattison

Well-known member
Joined
Sep 9, 2008
Messages
116
Programming Experience
Beginner
Im using a service to get a list of houses based on the input from a customer. When i pass in GetListHouse i get the error "Value of type 'HouseList' cannot be converted to '1-dimensional array of HouseList'.".

So i understand that i need to insert the item that im referring to i.e. Houselist(0) but the way ive coded it im wondering what would be the "correct" to do this?


Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Username = "user"
Password = "password"

Using svcHouseFinance As New HouseClient
svcHouseFinance.Open()
svcHouseFinance.Calculate(GetListHouse, Username, Password)
svcHouseFinance.Close
End Using
End Sub

Private Function GetListHouse() As HouseList
Dim hl As New HouseList

With hl
.Id = 1234
.Purchaser = DisplayPurchaserList
......
End With

Return hl
End Function

Thanks
 
Last edited:
Presumably Calculate expects a HouseList array while GetHouseList returns a HouseList object. You need to get that HouseList object, put it into an array and then pass the array.
 
Presumably Calculate expects a HouseList array while GetHouseList returns a HouseList object. You need to get that HouseList object, put it into an array and then pass the array.

This is a little trickier than i thought......

Dim arrHouseList() as HouseList

but none of the houselist properties appear?
 
Ok so if i have Dim myhouseList as Array then is that along the right line?

No, not a list it has to be an array (Im sure i tried a List and it didnt work)
 
Back
Top