# Bidimensional Array

## Recommended Posts

Hi i'd like to know how to put in an array, by an imputbox, some data.

```#include <Array.au3>
local \$var1

\$var1 =InputBox( "", "insert number of row")
\$var2 = 5 ; number of col
Local \$array[\$var1] [5]

For \$I = 0 To \$var1-1 step 1

\$array[\$I][\$I] = inputbox("", "insert value of first row")
next

_ArrayDisplay(\$array)```

that's what i've done. what i want to do is put the first value on col1 row1 [0][0] then he ask me again the \$value and i want to put that (it's a different number) on col2 row1 [0][1]. how can i do?

thank you.

##### Share on other sites

not sure if this will do ya:

```#include <Array.au3>
local \$var1

While Not Int(\$var1)
\$var1 = InputBox("","insert number of row")
WEnd
Local \$array[\$var1][5]

For \$i=0 To UBound(\$array,2)-1
\$array[0][\$i] = inputbox("", "insert value of first row")
next
_ArrayDisplay(\$array)```

explain it better, if not.

In case you want to manually populate everything:

```; to add all data:
For \$i=0 To UBound(\$array)-1
For \$j=0 To UBound(\$array,2)-1
\$array[\$i][\$j] = inputbox("", "insert value of row=[" & \$i+1 & "], col=[" & \$j+1 & "]")
Next
next
_ArrayDisplay(\$array)```
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

##### Share on other sites

```; to add all data:
For \$i=0 To UBound(\$array)-1
For \$j=0 To UBound(\$array,2)-1
\$array[\$i][\$j] = inputbox("", "insert value of row=[" & \$i+1 & "], col=[" & \$j+1 & "]")
Next
next
_ArrayDisplay(\$array)```

thank you it works, but i don't understand what means the 2 on "For \$j=0 To UBound(\$array,2)-1" i know that it modify the dim of the array but why 2? can you explaine that ?

i'm new to AutoIt and i remember ubound from vb but not well.

Edited by Mirus

##### Share on other sites

helpfile:

UBound ( Array [, Dimension] )

Parameters

Array The array variable which is being queried. Dimension [optional] Which dimension of a multi-dimensioned array to report the size of. Default is 1, which is the first dimension. If this parameter is 0, the number of subscripts in the array is returned.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...