We help IT Professionals succeed at work.

Problem working with dynamic array - help

hidrau
hidrau asked
on
193 Views
Last Modified: 2017-03-27
Hello Guys

I have an array of record.

I stuffed it in a form and I pass to another form through a procedure, it is ok so far.

But I declared a variable of the same type of my array, and when I call the function where I pass
my array I need to copy all the stuff of my source array to my new variable. When I try to do that
I have the following message:

"incompatible types dynamic array and array"

form1:

  form2 := Tform2.create(application)
  form2.processMyArray(MyArray)
  

form2

type 
    MyNewVariable : array of tprod;

   tform2.processMyArray(ar : array of tprod)
  Begin  
     MyNewVariable  := ar  --> Here I got that error message.
  end

     

Open in new window


How could I solve this?

Thanks
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks a lot friend, it worked.

the solution was this line: SetLength(MyNewVariable,Length(Ar));
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.