VB.NET Adding an image so that it shows up under My.Resources.TheImageName - vb.net

Using VS2012, I would like to add an image to the My.Resources. namespace.
I would like to draw this image to a PictureBox on the Paint event.
I did the following:
I clicked "Add existing item", then I opened up the image.
I clicked the image from the Solution Explorer and set the Build Task to "Embedded Resource".
I saved the project and re-built it.
But it still does not show up under My.Resources.
What did I do wrong, please?
Thank you for the help!
ps:
I do not want to add it directly to "Resources.resx" (for example by clicking the "BackGroundImage" property of a form).
I would prefer having the image in the solution explorer instead. I once experienced that VS2012 once damaged a file, and I had to rebuild the resource file. I would like to avoid it.

You need to add the image to the Resources tab in Project Properties, not to the project directly.

Related

Using a 3rd party control

Please excuse the noobness that is probably about to follow...
I'm making an vb.net 2010 app which needs to have a calendar system in which the user can add appointments and events etc.
I've downloaded the source for a control which looks promising (http://www.codeproject.com/Articles/10840/Another-Month-Calendar) but I have no idea how to add this in to my project. I've googled for help on adding the control but have had no luck.
If I right click on my toolbox, go 'choose items...' and try and add it there, it tells me it couldnt be opened.
Any help is appreciated!
Well you've downloaded the source code.
Place the source code in a specific location on your pc and then compile it 9If your planning to use this control in your own project then compile it in release mode. Assuming that there are no compile errors close visual studio and then open up the project of your own that you want to use this control in.
Right click on the general tab in the toolbox and click choose items. Using the bowse button in the choose items dialog navigate to the folder in which you placed the source code for the control you want to use.
Now locate the 'Bin' folder and in that locate the 'release' folder. Inside that you will see a dll (named presumably something like MothCalendar.dll. Select that dll and then click add and OK (Button sequence will vary according to vs version). The control should then appear in your toolbox under the general tab and you should then be able to drag it onto your forms for use in your project.

VB.Net 2010 Resources Not Working After Importing

When I go to set the Image on a regular Button, and get to the Select Resource dialog, I can select an imported resource, but the preview does not show up. This is true for all of the imported resource images, not just one of them. If I try to go on and hit OK, it still says "(None)" in the Image property of the Button.
I've tried deleting the resource files and re-importing, both from the Select Resource dialog, and from Project Settings -> Resources. Under Project Settings -> Resources, the images show up just fine. All of the images are PNG's and were previously working yesterday.
Any suggestions?
I was able to resolve this by doing the following:
Remove all image resources from the program.
Look through all of *.Designer.vb files of for lingering references to the any of the image resources (I found a few).
Close completely out of Visual Studio.
Re-open the project.
Add the image resources back.

Icon is not shown in the taskbar

On other forms, the icon is shown in the taskbar but only in this form, the icon is not shown in the taskbar.
I also made sure that there is an icon in the form's property.
Right Click the Project file and Select Property as follows
Now Change the default Icon here
Have you run the program from the exe in the debug/release folder.
I've found that the icon doesn't show in the taskbar when run from the debugger.
Edit: Just realised how old this is.
Well, hopefully this will help someone else.
To change the main icon for your application, go to the "Application" tab under the project property page, and change the "Icon:" combo box.
You can change icon form from properties form like this picture.
You need to change icon of application from Project Properties -> Application -> Icon
In properties of the form, browse for an icon in the icon tab.
Make sure that the picture you are using is in .ICO format. Sometimes, in newer versions, the language accepts images other than .ICO format but can produce error and doesn't display correctly everywhere.
Make sure that the .ICO you have converted is in more than 1 or 2 sizes (.ICO files have many resolutions in just one file).
I hope you understand!
In addition to other answers here, make sure that the 'ShowInTaskbar' property on the form is set to true. Sometimes settings get toggled. Toggle it back.

can't locate VB picture

I've been modifying a picture, and the Old picture still does work even though I've delete all pictures in the vb project. Is there somewhere that still has reference to pictures in the project? If anyone could help me ,thank you!!
Go to Solution Explorer, click the down arrow next to Form1.vb
Then double click on Form1.resx
This should bring you to any images in your project that you can easily save to disk by
right clicking and selecting Export to File.
Images are in the .resx file.

Application crashes when calling embedded resources

I'm writing a console application in Visual Basic 2008 Express.
I added several text files to my project as resources. Specifically...
I went to my project's "Properties" page and selected the "Resources" tab.
I clicked the "Add Resource" dropdown and chose "Add New Text File".
I entered some simple text and saved the file as "Welcome.txt".
I built the entire solution.
In my code, I use console.writeline(My.Resources.Welcome) to display the text.
If I run my code through the IDE, it works fine.
If I run the EXE that's in the /bin/release folder, the app crashes.
My system logs show the error as "System.IO.FileLoadException".
I have tried setting the properties on the embedded text file to "Embedded Resource", but the result is the same.
Has anyone encountered this issue? Thank you in advance.
Copy Welcome.txt to your bin\release folder.
OR
To make Welcome.txt an embedded resource, right-click either the text file or the bitmap, and then select Properties.
In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource.