Jump to content

For In Next - Two dimensional array


moocher
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...