| |

VerySource

 Forgot password?
 Register
Search
View: 824|Reply: 2

On the assignment of dynamic arrays

[Copy link]

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-12 16:00:01
| Show all posts |Read mode
I have a dynamically shaped array in unit1
index_Arrary: Array of Integer;
setlength (index_Arrary, imagelist1.Count);
    for i: = 0 to toolbar1.ButtonCount -1 do
    begin
      index_Arrary [i]: = toolbar1.Buttons [i] .ImageIndex;
    end;
I also have an array index_Arrary2 in unit2: Array of Integer; for receiving!
My question is how do I assign all the contents of my array in cell 1 to this array in cell 2?
My unit2 is the main form that runs first! If it is assigned, the array of unit1 has no allocated space and definitely reports an exception!
What should I do?
Reply

Use magic Report

1

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-7-16 14:00:01
| Show all posts
Determine whether unit1 is created and the length of the array in unit1 is -1
Reply

Use magic Report

0

Threads

53

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-7-21 04:45:01
| Show all posts
You avoid assigning values ​​to the array when you create the main form Form, you can assign values ​​in the Show event
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list