Property setter was expecting a button but got a string instead

Hi there! It´s my first time here. Sorry if not the right place or just asked in others topics.
When running my app it appears this error message
“Property setter was expecting a com…Button component but got a string instead”

I think i made code rightly as here

recorte codigo error

I’m using a for each loop with id as a part of my list just made above there.

Since this code is just exactly the same that i made some time before in the MIT app inventor web, where it worked well, i am quite confused

Thanks in advance for all of your answers and advice

Change global like in the example



Thanks for your answer! :slightly_smiling_face: I’ll try it.
Best regards!

1 Like

I’ve just tried your suggestion, but the same error message appeared again

For me it works ok in my test.


May be he has more blocks with same logic that causes error.


It would really help if you provided a screenshot of your updated relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.


Thanks lot for your answers.

My code still doesn’t work no matter what changes or tests i can do.
There is no other blocks in my code.
I made a video and took screenshots that always show the same problem as ever

As you can see, it doesn’t recognise the id in the for each loop as a part of my list, but a string (?)
So, i can’t find up the error origin.

More thanks again for your answers and advice.




Many people have this misconception. The component name isn’t the id name. Every time the component is created, it holds different id.

Therefore, you should use the component block (the light green one) instead of a string.

@dora_paz’s solution is an example.

u are putting button names in to the variable so it is not working

u have to put the button component in variable like this

It wooorks!! :smiley: :smiley: :clap:t2: :clap:t2:

Thanks lots!!
Solved problem!!

thanks lot!! problem is solved! :ok_hand:t2: :ok_hand:t2:

ok got it and solved problem!! lot thanks!

1 Like

then i didn’t note the (green) type of the component block
thank you lot!

1 Like

Glad to hear :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.