Get Embedded Resource

2019-07-03 22:28发布

I have a zip file and I added it to my program's resource folder. I set the properties to embedded resource.

Now when I type my.resources. ...in the list the name of that file does not come but other image files comes.

I want to extract the zip file to a folder at runtime. I have done that before if I add zip file to my solution. But if the zip file is added into my resources folder (right click in resources, add, existing item) then how to get it from there.

Help will be appreciated. My program is written in vb.net 2008.

Cheers, GR

2条回答
混吃等死
2楼-- · 2019-07-03 22:39

You need to add the file as a typed resource. Adding file just to Resources folder does not generate resource wrapper property.

enter image description here

Then you can reference the file content by

Dim fileConent As Byte() = My.Resources.FileName

Replace the FileName with your file name. Intellisense will guide you.

查看更多
唯我独甜
3楼-- · 2019-07-03 22:42

Modify the property of added resource in solution explorer to "Embedded Resource"

查看更多
登录 后发表回答