Array Problem

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
 
J

Jack Jackson

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
 
S

StinkyDuck

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

-StinkyDuck
 

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