passing non-primitive values to array class

G

Guest

I have web service that acceping following parameters..
postev.PostEvent(authentication as ws.authentication, name as string,id as
string, exdate as date, parameter() as ws.nameparametervaluepair (I need help
in passing this))

Postev.postEvent(auth(), "Test", "1234567", tdt, parameter())

For the first parameter authentication I have:

Private Function auth() As ws.Authentication
Dim authWF As ws_sghe_WF.Authentication = New ws.Authentication()
authWF.principal = "test"
authWF.credential = "testpwd"
Return auth
End Function

It is working fine and I am connecting to web service

If I do the same thing for passing parameter()

Private Function parameter() As ws.NameParameterValuePair()
Dim parameter As ws.NameParameterValuePair()
parameter = New ws.NameParameterValuePair(2) {}

parameter(0).name = "string"
parameter(0).ItemElementName = "(e-mail address removed)"

parameter(1).name = "string"
parameter(1).ItemElementName = "my name"

Return parameter
End Function

I get following error:
Object reference not set to an instance of an object.

If I remove (2) from declaration:
Index was outside the bounds of the array

Any suggessions??
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top