|
-
November 17th, 1999, 05:24 PM
#1
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 (,)?
-
November 17th, 1999, 05:28 PM
#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
-
November 17th, 1999, 05:30 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|