Sign in to follow this  
Followers 0
moocher

For In Next - Two dimensional array

6 posts in this topic

I've got an array with two dimensions, and i want all the data from [x][0] to be in one long string

I've tried this and it doesnt work

Dim $typer[10][4]

$normalskema = 0
$overarbejde = 5
$hjemsyg = 7

$typer[$normalskema][0] = "Normal planlagt"
$typer[$normalskema][1] = 16
$typer[$normalskema][2] = 0

$typer[$overarbejde][0] = "Overarbejde"
$typer[$overarbejde][1] = 15
$typer[$overarbejde][2] = 3

$typer[$hjemsyg][0] = "Gået syg hjem"
$typer[$hjemsyg][1] = 17
$typer[$hjemsyg][2] = 7

For $type in $typer
    $typemenu = $typemenu & $type[0] & "|"
    MsgBox(0,0,$typemenu)
Next

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

For . In is only used with objects.

This is how you should have done it:

Dim $Array[5][2]

$Array[0][0] = "Valuator"
$Array[1][0] = "Smoke_N"
$Array[2][0] = "Helge"
$Array[3][0] = "Paulie"
$Array[4][0] = "nfwu"

Dim $Text
For $x = 0 to Ubound($Array,1)-1
     $Text &= $Array[$x][0] & @CRLF
Next

MsgBox(0, "$Text", $Text)

Edit: added "-1" after Ubound (Thanks herewasplato)

Edited by Manadar

Share this post


Link to post
Share on other sites

try

For $x = 0 To (UBound($Array, 1) - 1)


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

moocher...setter du meg opp som "hjemsyg" i morgen ? snøft, host, hark... ;):whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0