Adding and using a resource in dot net

Hi

Many a time we need to add some resources to the windows application, which will be used, by the application during its execution. Like many a time we want to give some sound (.wmv files) with the application, which will be played at certain points in the execution of the Application.

It’s Best to add these files as a resource to the application. We can use these resource in the Application later the way we want. Lets say we want to add some resource to the application.

To add resources to the application go to the properties of the application.  And then go to the resource tab. You can choose the type of resource that you want to add. (See the Image below).


Click on the add resource button and go to the path where the resource is located. This way we can add a new resource to the application.

Now to use the resource in the application use the following code

Application_Name.Properties.Resources.Name_of_the_Resource;

This way we can use the resources that we have added to the application.

Hope this helps
Thanks
Vikram


Share this post   Email it |  digg it! |  reddit! |  bookmark it!

Feedback

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 
Copyright © 2006 - 2008 Vikram Lakhotia