CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Integer Array in a Message Box

    I have an integer variable array with values that I want displayed in a message box. How do I show each value of the array in a message box, seperated by a comma (,)?


  2. #2

    Re: Integer Array in a Message Box

    IF you have vb6:

    dim sMsg as string
    sMsg = Join(myArray, ",")
    msgBox sMsg

    Charlie Zimmerman
    http://www.freevbcode.com



  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Integer Array in a Message Box

    Try something like :


    Dim iArr() as Integer
    Dim iCount as Integer
    Dim sOut as string
    '
    ' Populate the array - random length, random values
    '
    ReDim iArr(Rnd(1) * 10)

    for iCount = 0 to UBound(iArr)
    iArr(iCount) = Rnd(1) * 10
    next
    '
    ' Show the array in a string
    '
    for iCount = 0 to UBound(iArr)
    sOut = sOut & CStr(iArr(iCount)) & ","
    next
    '
    ' Remove last comma
    '
    sOut = Left$(sOut, len(sOut) - 1)
    '
    ' Show It !
    '
    MsgBox "Array is : " & sOut






    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured