Icon from ressource

  • Thread starter Thread starter Te-Deum
  • Start date Start date
T

Te-Deum

Hi,

I want to use icons that is loaded in ressource, but I don't know how to do
it ?
I use this function to load icon from file : Dim NewIcon As New
Icon("MyIcon.ico")

Thank's for your help.

Te-Deum.
 
Hello,

Te-Deum said:
I want to use icons that is loaded in ressource, but I don't know how to do
it ?

Add the icon file to your project and set its build action property to
embedded resource. You can use the code below to load the icon at runtime:

\\\
foo.Icon = _
New Icon( _
[Assembly].GetExecutingAssembly().GetManifestResourceStream( _
"WindowsApplication1.Ball.ico" _
) _
)
///

WindowsApplication1 is the root namespace of the application, Ball.ico is
the
icon's filename.

HTH,
Herfried K. Wagner
 
I try your solution, but it doesn't work.
Dim NewIcon As Icon
NewIcon = New
Icon([Assembly].GetExecutingAssembly().GetManifestResourceStream("MyApp.List
e.ico"))

I must add this line to recognize [Assembly] :
Imports System
Imports System.Reflection

The error come on the line : NewIcon = New Icon(...

Thank's for your help.
 
Back
Top