Re: Unlimited Array in Visual Basic 8



Joe,

I'm a very fresh beginner to VB.Net, so hopefully I won't screw this up, but
what you need to do is declare the array as you have in your example and add
a counter to loop through each value and assign it to the count value. In
psuedo-code it would look something like...

Declare your counter variable
Declare your array
For Each element in the input data
Assign the values to the array elements (Table(counter))
'Do other processing if necessary'
Increment the counter by 1 (counter += 1)
Next element

Of course, if you provided information on exactly how you are getting the
information to place in the array, others more knowledgeable than I would be
able to provide you with some more concrete information.

Bruce

"Joe" <joe1977@xxxxxxx> wrote in message
news:1172446541.137152.168540@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hi. simple question: how can one declare Array (or table) with unknown
number of elements, and then assign values to it, example:

Dim TableStrings() as String

TableStrings(0) = "first value"
TableStrings(1) = "second"
TableStrings(2) = "tird" .... etc


?



.



Relevant Pages

  • Re: Passing an array of structuresfrom a pointer?
    ... to only declare structs in headers and then define the ... the struct should be declared ... what if you have a simple array like this: ... In the header we would declare? ...
    (microsoft.public.vc.language)
  • Re: vb.net class
    ... about fixed array lenghts or using ReDim statements. ... code ensures everything in the array is a String because you declare it ... Count can be generated from the time list, not need to store ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Scope of Variant / Array
    ... Even though you declared the array "public" in the main (parent) form, ... a form code module is the same as a class module. ... Constants, fixed-length strings, arrays, user-defined types and Declare ...
    (microsoft.public.access.formscoding)
  • Re: ReDim not working as expected. Array expert needed.
    ... Any dimensions you declare your variable in are wiped out, ... variable as a variant, I next told you not to redim it. ... examples of how array dimensions work in VBA. ...
    (microsoft.public.excel.programming)
  • Re: Looking to improve program
    ... You generally should declare your variables in the smallest scope ... array. ... Now that you have the hash, you can use it instead of four nearly ... There's also no real reason to be assigning ...
    (comp.lang.perl.misc)