Tired of errors when I fall into that trap

No example project is needed, all is in this screenshot:
I added txtType. then I pressed the Tab key because of the error:

The error is Syntax Error.

I am dubious.

Well, it’s pretty clear, your variable declaration of myIcon is wrong.

' Wrong syntax.
Var myIcon As New Picture(1024, 1024) = txt.Icon

Should be

Var myIcon As New Picture(1024, 1024)

It doesn’t make sense anyway. First you create a new Picture, only to immediately replace it with another picture.

1 Like

and where is comes from? you just wrote new filetype.

if you add a filetype to the project i see a icon ui field.

xojo have its own syntax, generelly it looks ok but maybe you try the other way

Var myIcon As New Picture(1024, 1024) = txtType.Icon
Var myIcon As Picture = txtType.Icon
txtType.Icon = New Picture(1024, 1024)