How to add resources during runtime



How to add resources during runtime..

Answer / mithun

Call the GetLocalResourceObject or GetGlobalResourceObject method to read specific resources from a global or local resource file

The GetGlobalResourceObject method takes the name of a resource class and the resource ID. The class name is based on the .resx file name. For example, the file WebResources.resx, and all associated localized files, are referenced by the class name WebResources.

The GetLocalResourceObject method takes a resource name representing a ResourceKey property.

Button1.Text = GetLocalResourceObject("Button1.Text").ToString();

Button2.Text = (String)GetGlobalResourceObject(
"WebResourcesGlobal", "Button2.Text");


A local default resource file stored in the special App_LocalResources folder is named according to the ASP.NET page. For example, if the following code is used in a Default.aspx page, the resource file must be named Default.aspx.resx. For this example, add a string resource to this file named Button1.Text with the value "Found Resources".

A global default resource file that is stored in the special App_GlobalResources folder is named WebResourcesGlobal.resx. Add a string resource named LogoUrl with the value "Found Resources".

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net WindowsForms Interview Questions

We are facing problem with the compatibilty of IE 7 and IE 6.We are calling a showModal window that is working fine in IE6 but with IE7 it opens a new Window and Data is not getting poputaled.In some pages it Gives an error "The webpage you are viewing is trying to Close the window.Do you want to close this window".

1 Answers   Wipro,


Which interface is to be implemented to release the unmanaged resources in an object in Dot Net?

1 Answers   Arctern,


Which command prompt utility is used to convert a resource file from the text format into the binary format?

0 Answers  


Explain how to split a column header in gridview using c#.net?

0 Answers  


How to create class level variable that can be assigned value at the time of declaration and in the constructor alone?

1 Answers   Arctern,






How to find the current record position in data control?

1 Answers   TechSolution,


how to create a set up in vb.net for desktop application please say me steps with examples

1 Answers  


Explain something about crystal report in brief?

0 Answers  


What is the difference between desktop application and windows application?

0 Answers  


What are windows based applications?

0 Answers  


What are different authentication types. How do you retrieve user id in case of windows authentication?

5 Answers   Microsoft,


Tell a very common use of private constructor?

1 Answers   Arctern,


Categories