Re: Multiple Forms - Cannot access array
Posted by webmaster Guido on January 18, 2003 at 15:27:38:
In Reply to: Multiple Forms - Cannot access array posted by Mike Baily on January 17, 2003 at 17:56:03:
: I am using multiple forms for the first time. I have created an array in unit1.pas I have created a new form. From form2 if I enter form1.
: How do I access the array that I created in 1 form and allow the user to amend it from another form?
1. Declare your array in the "interface" section of Form1, right under the line that says "public" (instead of declaring the array under "var"). That way, it becomes a "field" of Form1 that can be accessed from other units. Example:
3. In order to access the array from Form2, put "Form1." in front of it, for example: