views:

172

answers:

2

I have a Icon(.ico file) in the (VB.NET)MyProject>Resources.resx file.

How do I extract it in run-time as a Icon object?

Thanks

+4  A: 

You should be able to do the following:

Dim myIcon as Icon = [Your Project Namespace].Properties.Resources.[icon name]

It should pop up with Intellisense.

NOTE: My VB is a bit rusty and I've been using VS 2008 for quite some time, so my apologies if this isn't quite right in syntax or not the way to do it in VS 2005.

UPDATE: Apparently the VB way of accessing [Your Project NameSpace].Properties is to use the My keyword:

Dim myIcon as Icon = My.Properties.[icon name]
Jason Down
Properties.Resources. my icon is not appearing although i can see it in the the solutions explorer. and yes it is embedded
jaminator
+1  A: 

Your icon will show up with intellisense under My.Resources as in:

My.Resources.<name of icon>
hawbsl