Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert array contents in messagebox 1

Status
Not open for further replies.

AlexIT

Technical User
Jul 27, 2001
802
0
0
US
I want to post the output of a portion of a string array into a message box. I was trying something like this:

For j = 0 to endrow
For i = 0 to endcol
strOut = strOut & strArray(j, i) & (CHR(13))
next i
next j

msgbox(strOut)

This only displays the last line...any ideas?

Thanks,
Alex
 
Hi Alex,

Can you post your actual code? What you posted wouldn't work at all in FoxPro.

Jim
 

Alex,

What do you mean by a "string array"? If it is an ordinary string, use the SUBSTR() function. If you want to concatenate elements of an array, you will have to loop through the array, adding the strings together.

Also, msgbx() is the wrong function. You need MESSAGEBOX().

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Alex,

Your problem is written in VB, However, here's the VFP version that works. I tried it with a 2x2 array.

Code:
*Setup an example
dimension strArray(2,2)
strArray(1,1) = "AAA"
strArray(1,2) = "BBB"
strArray(2,1) = "CCC"
strArray(2,2) = "DDD"
store 2 to endrow,endcol

*Run the Test
strOut = ""
For j = 1 to endrow
  For i = 1 to endcol
    strOut = strOut + strArray(j, i) + (CHR(13))
  next i
next j
messagebox(strOut)

Tony
 
Cool,I didn't think there was much difference. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top