Also keep in mind that when you redim the array - you will lose the contents
unless you use the preserve keyword to maintain the contents. You may want
to look into using the ArrayList class rather than using a standard array
since this grows as needed plus you can sort and so on.
Brian Patterson
http://dotnet.redeyepos.com
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:es0CvAb$EHA.3372@TK2MSFTNGP10.phx.gbl...[color=blue]
> "Adrian" <Adrian@nospamhotmail.com.uk> schrieb:[color=green]
>> In VB 6 I would declare an array in the general part to make it visible
>> to all parts then once I know how elements I had I would redim it with
>> the amount thus
>>
>> Dim testarray() as string
>>
>> ......
>> ......
>>
>> Redim testarray(9) as string
>>
>> How do I do this in VB.Net?[/color]
>
> It works the same, but you'll have to remove the 'As String' on the
> 'ReDim' statement. Notice that 9 is treated as the upper-bound of the new
> array, so the array will hold 10 items with indices 0 through 9.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>[/color]