I have a Picture in an ImageView:
ImageView_Artikel1.Picture
I load a .csv file into my project, extract the names of the articles and want to load the pictures with this name.
The pictures are in my Xojo project. I drag & drop it into the project.
When I’m using this, it works:
ImageView_Artikel1.Picture = H8-HK13234
But the problem is, I have the names in strings, and want to give the pictures the names.
DIM String_NameBild1 As String
String_NameBild1 = “H8-HK13234.png”
ImageView_Artikel1.Picture = String_NameBild1
But then I got a type mismatch.
How can I give the Picture-Variable the name of the picture via a string?
[quote=210876:@Thomas Mueller]I have a Picture in an ImageView:
ImageView_Artikel1.Picture
I load a .csv file into my project, extract the names of the articles and want to load the pictures with this name.
The pictures are in my Xojo project. I drag & drop it into the project.
When I’m using this, it works:
ImageView_Artikel1.Picture = H8-HK13234
But the problem is, I have the names in strings, and want to give the pictures the names.
[/quote]
Use a dictionary. It will let you store the picture in a string key.
I am unsure, but why dont you load the image from the Photos_Articles folder using its name and then set this to ImageView_Artikel1.Picture ?
Open the image from its folder (path to the Photos_Articles folder folder .Child ) into a local Picture variable
then apply that local Picrure variable to ImageView_Artikel1.Picture.
[quote=210926:@Thomas Mueller]Because at the opening of the app, I don’t know, which photos I’ll need.
The .csv - file with the names shows me, what pictures I have to load and show.[/quote]
Yes, but you have all the images handly, somewhere in a defined folder.
So, you define a FolderItem that point to that folder and define a FolderItem for this image using f.Child(ImageName) then you load it.
Norman simili code looks what I had in mind (but was not really able to explain yesterday).
If this is not enough, explain why / explain from where you take the image to display and we may be able to give a better hint.