Home All Groups Group Topic Archive Search About

Why this warning in IDE?

Author
2 Sep 2006 8:25 PM
rdufour
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

Author
2 Sep 2006 9:14 PM
sweet_dreams
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
Author
3 Sep 2006 12:13 AM
Scott M.
Dim Myfiles(upperArrayBoundry) As String



Show quoteHide quote
"rdufour" <bduf***@sgiims.com> wrote in message
news:eu9V63szGHA.4796@TK2MSFTNGP06.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
>
>
Author
3 Sep 2006 7:59 AM
Michel Posseth [MCP]
Dim Myfiles() as string={"filename1","filename2","filename3"}

regards

Michel



Show quoteHide quote
"rdufour" <bduf***@sgiims.com> schreef in bericht
news:eu9V63szGHA.4796@TK2MSFTNGP06.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
>
>