Re: Unlimited Array in Visual Basic 8

Tech-Archive recommends: Fix windows errors by optimizing your registry



Michel,

I am 100% sure that Herfried this knows.

Cor

"Michel Posseth [MCP]" <msnews@xxxxxxxxxxx> schreef in bericht
news:up0t2EdWHHA.896@xxxxxxxxxxxxxxxxxxxxxxx
or take a look at the array class


Dim x(1) As Integer ' create instance with one element

For i As Integer = 1 To 10

Array.Resize(x, x.Length + i) ' add some elements during runtime

Next

' to proof that it works

For Each i As Integer In x

Debug.WriteLine(i.ToString) ' writes out all zero`s for every element

Next

ofcourse you could do the above example with anny type you want

regards

Michel Posseth



"Herfried K. Wagner [MVP]" <hirf-spam-me-here@xxxxxx> schreef in bericht
news:%23rvLecTWHHA.496@xxxxxxxxxxxxxxxxxxxxxxx
"Joe" <joe1977@xxxxxxx> schrieb:
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

You may want to use 'System.Collections.Generic.List(Of T)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>




.



Relevant Pages

  • Search pattern
    ... Dim strfile As String ... Dim bAddressFound As Boolean ... Dim strCurrentChar As String ...
    (comp.databases.ms-access)
  • Auto Write Name and Merge across
    ... Dim Sheetname01 As String ... Dim WeekName01 As String ...
    (microsoft.public.excel.misc)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)
  • Help answer these 70-310 questions
    ... One argument is the string ... Dim output As New StringBuilder ... EmployeeLocations. ... You create a strongly named serviced component. ...
    (microsoft.public.cert.exam.mcsd)