Click here to Skip to main content
15,069,133 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The file is saved as resource. How to obtain that name of the file into tree View?

What I have tried:

private void Form1_Load(object sender, EventArgs e)

Build says cannot convert from string to System.Drawing.Icon.
Updated 24-Jul-20 21:31pm
Gerry Schmitz 23-Jul-20 9:29am
..GetString() returns a string; ..Images.Add() does NOT (just) take a string; it takes an icon or image, at least.

1 solution

Try following:
treeView1.ImageList.Images.Add("myImage", Properties.Resources.IconNameInResource);

BTW, will suggest following read - from a defined ImageList: Redirect Notice[^]
Member 12712527 24-Jul-20 5:00am
After Properties.Resurces no Name of the .png file as mentioned in the resource is comming...
Member 12712527 24-Jul-20 5:02am
After Resource. onle culture,equals, reference equal and resource manager is comming.
Sandeep Mewara 24-Jul-20 5:16am
You need to add icon to your resource file.
Sandeep Mewara 24-Jul-20 5:23am
Some references of it can be picked from here on how to add image to resource:
Sandeep Mewara 25-Jul-20 3:30am
That did not help?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900