I’m obviously missing something, as a beginner in Xojo!
My app opens a text file in which data is stored in 3 lines for each complete record. The code creates 3 arrays with the data, and also displays this in 3 Listboxes. The arrays are created thus:
Var aTitle(), aMP3(), aPDF() as String ’ 3 Arrays for the data
All this works as it should. The code for this is all in Controls / Listbox1 / Open. There is no code in the other 2 Listboxes
I have put a PushButton below the displayed Listboxes to do further processing when clicked. At its simplest, this will just be a MessageBox displaying the last entry in all the arrays.
The counter variable for the arrays is i and the code is
MessageBox("Last Record: " + aTitle(i) + EndOfLine + EndOfLine + aMP3(i) + EndOfLine + EndOfLine + aPDF(i))
This MessageBox code works if it is in the Listbox1 / Open code
Here is the problem. The MessageBox code does not work if I move it to the Pushbutton1 / Action code because the arrays and other variables are not available in the Pushbutton1 / Action code (“Does not exist” errors).
I’ve seen a similar question on the forum where a solution given was " Make the array a “more global” property (property of the window or app or a module) and access it from both places." The OP in response said “Just dropped a property on the window and now I can access from everywhere” but I don’t understand how I would do that, though it sound to be just what I need!
Please tell me how I get the arrays and variables in the Listbox1 / Open code to be available in PushButton1 / Action
Thanks