System.IO.FileNotFoundException: Could not find file

IrakliA
Contributor
Contributor

System.IO.FileNotFoundException: Could not find file

IrakliA
Contributor
Contributor

Hi all,

 

I am trying to create a panel and attach a tooltip image. However, once I open my Revit file, I the warning that the file cannot be found:

System.IO.FileNotFoundException: Could not find file 'C:\_blog\cbb\res\tooltip\Toottip_Image_320x320.png' File name: 'C:\_blog\cbb\res\tooltip\Toottip_Image_320x320.png'

...

 

The code with which I am trying to access the file looks like this:

var TagWallLayersBtnData = new PushButtonData("TagWallLayersBtnData", "Tag Wall\nLayers", Assembly.GetExecutingAssembly().Location, "cbb.TagWallLayersCommand")
{
ToolTipImage = new BitmapImage(new Uri(@"C:\_blog\cbb\res\tooltip_TagWallLayers_320x320.png")),
ToolTip = "This is some sample tooltip text, replace it later..."

 

If you have a common experience, how can I solve the issue?

 

Thanks in advance

0 Likes
Reply
Accepted solutions (1)
2,291 Views
1 Reply
Reply (1)

IrakliA
Contributor
Contributor
Accepted solution

SOLVED

 

The type of the image was .png. However, in addition to that I was including .png in the naming as well (ToolTip_Image.png). The .png in the naming is extra. Thus, while executing code Revit was trying to find a file called ToolTip_image with the extension .png while my files name was ToolTip_Image.png with the extension .png.

All I had to do was to name my file ToolTip_Image (without .png extension) and leave the code as it was (@"file path\ToolTipImage.png)