Use included image file in solution

Harcon

Member
Joined
May 8, 2012
Messages
18
Programming Experience
1-3
I have included a file in my project solution. Now i want to use in my code.
What's is the code to call the image file. rather then specifying a location on my computer?
 
VB.NET:
With xlWorkSheet1.PageSetup.RightHeaderPicture
            .Filename = My.Resources.Vermaat_logo_web

Error 4 Identifier expected. C:\Users\hcontent\Documents\Visual Studio 2010\Projects\Vermaat Logistiek\Vermaat Logistiek\RapportModule.vb 424 54 Vermaat Logistiek

can you tell me what i should do?
 
What do you mean by that?
the full code of the sub is.


VB.NET:
    Public Sub InsertPicture()
        With xlWorkSheet1.PageSetup.RightHeaderPicture
            .Filename = My.Resources.Vermaat_logo_web.ToString
            .Height = 50
            .Width = 75
            .ColorType = Microsoft.Office.Core.MsoPictureColorType.msoPictureAutomatic
            .CropBottom = 0
            .CropLeft = 0
            .CropRight = 0
            .CropTop = 0
        End With

        ' Enable the image to show up in the left header.
        xlWorkSheet1.PageSetup.RightHeader = "&G"
    End Sub
 
Well there you go that's not it... I really have no way to know, hence my original less than helpful message. Debugging is something you gotta do yourself. Double click the error message it will bring you to the error location in the IDE.
 
Well one thing i know already, is dat i need to get the String of the image in my.resources. Can you tell me how to get that string?
 
RightHeaderPicture.Filename expects a path to a file. You don't have that, the resource only exists inside the compiled assembly. You would have to save to a file, and then you have file path that you can use.
If you don't need the resource, then don't include it as resource, instead include it as Content/Copy to output.
 
Back
Top