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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does EB support 2 dimensional arrays?

Status
Not open for further replies.

tescojez

Programmer
May 28, 2007
10
GB
Hi people,

I'm quite new to EB (in fact haven't programmed for 10 years!). I have written some quite sophisticated scripts recently but am now struggling with multi dimensional arrays! I have used single level successfully.

I thought that the declaration would be something like:

Code:
dim array1(50,50) as string
dim array2(50,50) as double
And the usage would be:

Code:
For x = 1 to 50

     For y = 1 to 50

           array1(x,y) = "XXX"
           array2(x,y) = 99.99

     Next y

Next x
But it won't compile

Advice please.
 
The code compiles just fine for me in 7.11, tescojez. If you restart everything and drop this code into a brand new script, does it work? Maybe some other part of the script is keeping it from compiling? Have you declared x or y elsewhere in the same scope?
 
What error message is the compiler giving you?

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Thanx so much Guys - got back tonight, (after a week away with no access! - long story but I work for the big T in the UK) I spotted the problem, corrected it and we are running fine. However - Secondary question - can I use arrays in a Dialogue box - Switching to additional Dialogue boxes when necessary?
 
You can use 1 dimensional arrays as a list in a dialog box. If you use a dialog function, you can load sub-dialog boxes. However, these dialog boxes are modal. So, you could see the original dialog box, but not interact with it.

Code:
Dim iWindow
Declare Sub GoGoDialog

Function FileDlgFunc(identifier$, action, suppvalue)
    FileDlgFunc = True
    Select Case action
    Case 2
        Select Case identifier$
        Case "ButCancel"
            FileDlgFunc = False
        Case "ButOK"
            GoGoDialog
        End Select
    End Select
End Function

Sub GoGoDialog
    iWindow = iWindow + 1
    Begin Dialog ThisDlg 100, 40, "My Window", .FileDlgFunc
       Text     5,  5, 90, 10, "Window Count: " & iWindow
       PushButton  5, 20, 40, 15, "OK", .ButOK
       CancelButton  50, 20, 40, 15, .ButCancel
    End Dialog
    Dim mydialog as ThisDlg
    On Error Resume Next
    Dialog mydialog
End Sub

Sub Main
    GoGoDialog
End Sub
 
Thanx skie,

Sorry for the extremely long delay in replying to this - I got dragged off to a totally different project!

I used the principles in your code and I am having great success with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top