Array Problem

  • Thread starter Thread starter StinkyDuck
  • Start date Start date
S

StinkyDuck

The code below errors with the following message:
Object reference not set to an instance of an object.

I realize the the object is not instantiated but I can't seem to figure out
how to instantiate the object.

If I change the code to:
Dim MyParams() As mapItem = New mapItem

Then I get the following error on the SearchCandidates line.
Error 3 Value of type 'TaleoTest.TaleoWebAPI.mapItem' cannot be converted to
'1-dimensional array of TaleoTest.TaleoWebAPI.mapItem'.

Public Function SearchCandidates(ByVal nDays As Integer) As
SearchResultArr
Dim Result As SearchResultArr = New SearchResultArr
Dim MyParams(1) As mapItem

MyParams(0).key = "updatedWithin"
MyParams(0).value = nDays

SearchCandidates = vTaleoWebAPI.searchCandidate(vTaleoSessionID,
MyParams)
End Function
 
The code below errors with the following message:
Object reference not set to an instance of an object.

I realize the the object is not instantiated but I can't seem to figure out
how to instantiate the object.

If I change the code to:
Dim MyParams() As mapItem = New mapItem

Then I get the following error on the SearchCandidates line.
Error 3 Value of type 'TaleoTest.TaleoWebAPI.mapItem' cannot be converted to
'1-dimensional array of TaleoTest.TaleoWebAPI.mapItem'.

Public Function SearchCandidates(ByVal nDays As Integer) As
SearchResultArr
Dim Result As SearchResultArr = New SearchResultArr
Dim MyParams(1) As mapItem

MyParams(0).key = "updatedWithin"
MyParams(0).value = nDays

SearchCandidates = vTaleoWebAPI.searchCandidate(vTaleoSessionID,
MyParams)
End Function

Dim MyParams() As mapItem = { New mapItem }

or

Dim MyParms(1) as mapItem
MyParams(0) = New mapItem
 
Dim MyParams() As mapItem = { New mapItem } worked for me. Thank you very
much! I have been stuck on this for a few hours.

-StinkyDuck
 
Back
Top