Problem with Control and Hashtable on Device

CryoGenID

Active Member
Licensed User
Longtime User
Hello everybody :)

I have just implemented a hashtable in my application, which runs perfectly
fine on the desktop.
But I cannot compile it for the device, as I get an error stating I should use the "Control (Name, Type)"-Version...

This is the version, working only on the desktop:
B4X:
Control(arrayIn).AddOrUpdate(i, SubString (tempArray(i).Text,0, 2))

arrayIn is a string with the name of the hashtable, tempArray is an array where I take out values and insert them into the hashtable (using "i" as the key).

As stated before, this works perfectly well on the desktop, but does not compile for the device. :sign0085:

Any help is greatly appreciated :):)

Thanks and best regards,

Chris
 

agraham

Expert
Licensed User
Longtime User
Do what the error message says.

Control(arrayIn, Hashtable).AddOrUpdate(i, SubString (tempArray(i).Text,0, 2))

It is not a device specific error. Optimise compiling for the desktop would show the same error. See Help -> Main Help -> Keywords -> Runtime control management -> Control
 

CryoGenID

Active Member
Licensed User
Longtime User
Agraham,

thanks for your reply.

Well I tried that already but now I get this error (when I try to compile for the device, on the desktop it works perfectly):
Error compiling program.
Error message: error CS1525: Invalid expression term ')'
Line number: 100
Line: Control(arrayIn, Hashtable).AddOrUpdate(i, SubString (tempArray(i).Text,0, 2))

But when I count the brackets I don't find any one missing or too much :-(

B4X:
Control(arrayIn, Hashtable).AddOrUpdate(i, SubString (tempArray(i).Text,0, 2))

Thanks a lot for any help :sign0085: :)

Best regards,

Chris
 
Last edited:

agraham

Expert
Licensed User
Longtime User
I guess this is where the error is.

"tempArray(i).Text"

Arrays don't have properties but the IDE is a bit too forgiving in cases like this but the optimising compiler isn't, it is a lot stricter. Again the issue is not desktop versus device but legacy/IDE compiler versus optimising compiler
 

CryoGenID

Active Member
Licensed User
Longtime User
Agraham,

thanks a lot, you (once again *g*) saved my day :sign0060::sign0060:

That was exactly the problem!
Now it working perfectly ok :)

Thanks again!

Best regards,

Chris
 
Top