VB6 dynamic array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhitam30111985
    New Member
    • Aug 2007
    • 112

    VB6 dynamic array

    Hi all .. i am trying to create a dynamic array in visual basic 6.0 (not .net)

    Now i know abt redim and all ... but in that we need to know the array size before hand ... what if we want to define the size of the array on the run time ?

    Something like this :

    Code:
    Dim dllname() as string 
    
    dllname = split("My name is anthony gonsalves"," ")
    now above is possible if i dont have to declare dllname before hand ..
    But due to company rules it is necessary for me to put an Option explicit statement ....


    any ideas ?
  • rhitam30111985
    New Member
    • Aug 2007
    • 112

    #2
    never mind :

    dllname() = split(...)


    :P

    Comment

    • rpicilli
      New Member
      • Aug 2008
      • 77

      #3
      Hi

      If you do not need the old contents of your array you can count the total words and use redim like:

      Code:
      dim myStr as string = "This is your entry words"
      dim myTmpArr() as string = split(myStr, " ")
      dim iNumStr as integer = myTmpArr.Count
      redim otherArr(iNumStr)
      I hope this help

      Rpicilli

      Comment

      Working...