Results 1 to 7 of 7

Thread: read values from multi-dimensional array

  1. #1

    Thread Starter
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861

    read values from multi-dimensional array

    I am reading registry values, which are returned in a multi-dimensional array.
    I can debug.print to see the values just fine, but what I would like to do is add these values to a comma delimited string.

    Any ideas how I can do this?

    Here's the code
    VB Code:
    1. If Len(mstrSystem) <> 0 Then
    2.    strRegSettings = GetAllSettings(mstrSystem, "Options")
    3.                
    4.    For i = LBound(strRegSettings, 1) To UBound(strRegSettings, 1)
    5.       Debug.Print strSettings(i, 0), strSettings(i, 1)
    6.    Next i
    7. End If
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    Can't you just loop through them adding each one to a string, and adding a comma after them?

    That's too simple, so I guess I don't understand the question.

  3. #3

    Thread Starter
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    I guess I just overlooked the obvious. I just did this...
    VB Code:
    1. Dim i As Integer
    2. Dim a As Integer
    3.  
    4. For i = LBound(strRegSettings, 1) To UBound(strRegSettings, 1)
    5.    For a = 0 To UBound(strRegSettings, 1)
    6.       strSettings = strSettings & strRegSettings(i, a) & ","
    7.    Next a
    8. Next i
    9.  
    10. MsgBox strSettings
    Last edited by Memnoch1207; Sep 9th, 2004 at 04:36 PM.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  4. #4
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    since i took the trouble (albeit small) to code it Ill post even though you found a solution:

    VB Code:
    1. Public Function CSV3(a() As String)
    2. Dim i As Integer, j As Integer, k As Integer
    3. CSV3 = ""
    4. For i = LBound(a, 1) To UBound(a, 1)
    5.     For j = LBound(a, 2) To UBound(a, 2)
    6.         For k = LBound(a, 3) To UBound(a, 3)
    7.             CSV3 = CSV3 & a(i, j, k) & ","
    8.         Next
    9.     Next
    10. Next
    11. End Function

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    That's what I was thinking....though to make a comma delimitted string, I would tend to separate the values with commas.

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    Damn, too slow again! My reply was to Memnoch, not Muddy.

  7. #7
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    yeah... too bad the forums dont have a slide sorter function like Powerpoint :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width