Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 4 Jahren, 8 Monaten
Letzter Beitrag:
vor 4 Jahren, 7 Monaten
Beteiligte Autoren:
leos79, Ned!

ArrayAdd function called. Incompatible types during assignment

Startbeitrag von leos79 am 09.05.2013 17:56

Hi

Tengo un array, declarado así:
I have an array and a .net object, declared in this way:

arr is array of TIPO_CMDF_GEOCOD_LOTE_A dynamic
T is TIPO_CMDF_GEOCOD_LOTE_A dynamic


luego tengo 2 bucles, en un bucle, le añado 100 elementos, así:
then, i have a nested iteration, to add 100 items to the array each time, for n times:

for n=1 to x
for 100 times
T=new TIPO_CMDF_GEOCOD_LOTE_A
...do stuff with T
ArrayAdd(arr,T)
end for
...do stuff with arr
ArrayDeleteAll(arr)
end for

The problem I have is that this code works one time, when n=1, but for n=2 I get the following error, on the arrayadd line:

"windev ArrayAdd function called. Incompatible types during assignment"

I've tried using variablereset instead of arraydeleteall, I've tried declaring the array as dinamic, not declaring the object as dynamic and all the combinations and this is the best i can get (with other definitions i cant even go through the first loop)

Any ideas?

Thank you very much!

Antworten:

Hi Leos,

Have you tried using another method for adding to your array? e.g.

You could also try to use "Delete" to free the 'arr'?


for n=1 to x
for j = 1 to 100
T=new TIPO_CMDF_GEOCOD_LOTE_A
...do stuff with T
arr[j] = T
end

...do stuff with arr
Delete(arr)
end


Thanks
Ned!

von Ned! - am 10.05.2013 14:08
Thanks for your answer, Ned!

I've tried your solution but it was the same thing.

I've noticed that the array type changes to "object" type after I send it to a .NET function as a parameter. I don't know why since the .NET function (which I made) does not initializes the array, it just read it.

I've "patched" it declaring the array dynamic, and re-initializing it after each loop.


Regards!

von leos79 - am 04.06.2013 20:35
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.