Setting an ArrayOf_xsd_string

R

russganz

I have wsdl structure that looks like this

<xsd:complexType name="ReportSpec">
<xsd:sequence>
<xsd:element name="ReportType" type="xsd:int" />
<xsd:element name="parameters" nillable="true"
type="impl:ArrayOf_xsd_string" />
<xsd:element name="fromDate" nillable="true"
type="xsd:dateTime" />
<xsd:element name="toDate" nillable="true"
type="xsd:dateTime" />
</xsd:sequence>
</xsd:complexType>

If I use this code
Dim myReportSpec as new ReportSpec
myReportSpec.parameters(0) = "X"

I am unable to set the parameters value as I always get a error

Object reference not set to an instance of an object.
Use the 'new' keyword

I see that myReportspec.parameters = nothing but I have been unable to
figure out how to initialize the array. How does one do this
 
J

John Saunders [MVP]

I have wsdl structure that looks like this

<xsd:complexType name="ReportSpec">
<xsd:sequence>
<xsd:element name="ReportType" type="xsd:int" />
<xsd:element name="parameters" nillable="true"
type="impl:ArrayOf_xsd_string" />
<xsd:element name="fromDate" nillable="true"
type="xsd:dateTime" />
<xsd:element name="toDate" nillable="true"
type="xsd:dateTime" />
</xsd:sequence>
</xsd:complexType>

If I use this code
Dim myReportSpec as new ReportSpec
myReportSpec.parameters(0) = "X"

I am unable to set the parameters value as I always get a error

Object reference not set to an instance of an object.
Use the 'new' keyword

I see that myReportspec.parameters = nothing but I have been unable to
figure out how to initialize the array. How does one do this

The message gave you the answer. Use the 'new' keyword:

myReportSpec.parameters = New String(1)
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top