0

I have a Label which loads an image from my project's resources. For example, as it looks in properties panel, image property contains something like this AppName.My.Resources.Resources.x-image. How can I get all this to a string? As it is!!! I tried this, Label1.Image.ToString but it returns this, System.Drawing.Bitmap and not AppName.My.Resources.Resources.x-image. Any idea?

Simos Sigma
  • 958
  • 7
  • 29
  • 1
    Did I understand the question correctly? Are you looking for a way to get the string `"AppName.My.Resources.Resources.x-image"`? – Zohar Peled Mar 04 '18 at 11:39
  • @ZoharPeled: Yes my friend exactly!!! – Simos Sigma Mar 04 '18 at 11:40
  • [This post is for c# but I think it has what you want.](https://stackoverflow.com/questions/16361685/how-to-get-name-by-string-value-from-a-net-resource-resx-file) – Zohar Peled Mar 04 '18 at 11:59
  • @ZoharPeled: I converted it to vb.net but after some tries I can't understand how to use it, so I can't say if do the job!!! I am talking about the accepted answer from this question. – Simos Sigma Mar 04 '18 at 12:20
  • 2
    Even if you get it working it wont make the round trip - you will never get anything like `My.Resources.Resources.FooImg` from a Control (as per title). Especially if the image display changes (such as with a status) you would be better off loading the resource images to a `Dictionary(Of String, Image)`. You can get them by key and your app wont leak – Ňɏssa Pøngjǣrdenlarp Mar 04 '18 at 16:29

0 Answers0