Why this warning in IDE?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rdufour

    #1

    Why this warning in IDE?

    Dim Myfiles() as string
    Myfiles(0) = "filename1"
    I get a warning on line myfiles(0)=.. that myfiles has been used before it
    has been assigned a value a null exception may occur. Obviously this is bs,
    since I am in the process of assigning a value at that instant in code. How
    do I prevent this warning from appearing? Maybe I should code this in a
    different way?

    Any help would be appreciated.
    Bob


  • sweet_dreams

    #2
    Re: Why this warning in IDE?


    rdufour napisal(a):
    Dim Myfiles() as string
    Myfiles(0) = "filename1"
    I get a warning on line myfiles(0)=.. that myfiles has been used before it
    has been assigned a value a null exception may occur. Obviously this is bs,
    since I am in the process of assigning a value at that instant in code. How
    do I prevent this warning from appearing? Maybe I should code this in a
    different way?
    >
    Any help would be appreciated.
    Bob
    Bob,

    You get this warning because you haven't set size of array MyFiles. If
    you do this you won't get worning.

    Regards,
    sweet_dreams

    Comment

    • Scott M.

      #3
      Re: Why this warning in IDE?

      Dim Myfiles(upperAr rayBoundry) As String



      "rdufour" <bdufour@sgiims .comwrote in message
      news:eu9V63szGH A.4796@TK2MSFTN GP06.phx.gbl...
      Dim Myfiles() as string
      Myfiles(0) = "filename1"
      I get a warning on line myfiles(0)=.. that myfiles has been used before it
      has been assigned a value a null exception may occur. Obviously this is
      bs, since I am in the process of assigning a value at that instant in
      code. How do I prevent this warning from appearing? Maybe I should code
      this in a different way?
      >
      Any help would be appreciated.
      Bob
      >
      >

      Comment

      • Michel Posseth  [MCP]

        #4
        Re: Why this warning in IDE?


        Dim Myfiles() as string={"filena me1","filename2 ","filename 3"}

        regards

        Michel



        "rdufour" <bdufour@sgiims .comschreef in bericht
        news:eu9V63szGH A.4796@TK2MSFTN GP06.phx.gbl...
        Dim Myfiles() as string
        Myfiles(0) = "filename1"
        I get a warning on line myfiles(0)=.. that myfiles has been used before it
        has been assigned a value a null exception may occur. Obviously this is
        bs, since I am in the process of assigning a value at that instant in
        code. How do I prevent this warning from appearing? Maybe I should code
        this in a different way?
        >
        Any help would be appreciated.
        Bob
        >
        >

        Comment

        Working...