Setting an ArrayOf_xsd_string

Discussion in 'ASP .Net Web Services' started by russganz@gmail.com, Jan 19, 2008.

  1. Guest

    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
    , Jan 19, 2008
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    >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)
    --
    --------------------------------------------------------------------------------
    John Saunders | MVP - Windows Server System - Connected System Developer
    John Saunders [MVP], Jan 20, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Srinivasa Raghavan Sethuraman
    Replies:
    0
    Views:
    556
    Srinivasa Raghavan Sethuraman
    Jun 30, 2004
  2. CJ
    Replies:
    1
    Views:
    1,564
    Andrew Thompson
    Oct 29, 2004
  3. Sile
    Replies:
    5
    Views:
    690
  4. Replies:
    0
    Views:
    473
  5. Replies:
    2
    Views:
    1,098
Loading...

Share This Page