How to add icons into resource file

  • Thread starter Thread starter Kyaw Soe Lin
  • Start date Start date
K

Kyaw Soe Lin

Dear all,

I am developing a project using VB.NET. I would like to
add icons in the resource file like VB6 to use with my
buttons. But I can't find how to add resource file in
VB.NET and how to retrieve from it. Please give me a
guide how to do this.

Thanks,
Kyaw Soe Lin
 
You won't get a *.res file as in vb6.
Add YourIcon.Ico to YourProject as existing Item.
Set Build Action Property to Embedded Resource.
Use as follows (VB.Net example):

Imports System.Reflection.Assembly

Dim MyIco as New
Icon(GetExecutingAssembly.GetManifestResourceStream("YourProject.YourIcon.Ic
o"))
 
Mick

I am interested in the solution to this also. Is it possible to use res
protocol (res://) to reference the icons when they are added this way?

Charles
 
As far as I can ascertain you must use a standard win32res file to use that
protocol. Although in my previous post I said that you could not add *.res
files, it turns out that you can. You need to add it by manually compiling
with vbc.exe using the /Win32Resource switch. I have never used vbc manually
and have no idea how to reference those resources, but Iwould assume you
must use the ResourceReader Class, maybe someone else could enlighten us.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top