Strongly typed resource class, DOT NET Programming

Assignment Help:

Can we get a strongly typed resource class?

You can now get strongly types classes in the VS.NET intellisense as shown in the figure below.

42_resource class.png

Figure: - Strongly typed resource class

All belongs to the Resources namespace. Let do a small sample and see how the strongly typed classes work in the VS.NET 2005 and the simplicity which they bring while implementing globalization in the projects. The screen shot of the project is shown below. It is basically a simple login screen with user id and password text boxes. The User has options to select the language. Currently only two languages are provided English & Greek. Depending on the selected languages the user id and password label values will be displayed.

1013_resource class1.png

Figure: - Strongly typed project

The code snippet below describes the various important parts of the code. The First thing is the resource files. We have generated two resource files one for Greece with el and the second is the general resource file which will be used when the regional code does not match.

2357_resource class2.png

Figure: - Walkthrough for using the resources namespace

There are three main steps in the code:-

1) The First step is to set the culture information for the current thread with the new culture info object. The StrCulture has the language code which is presently selected in the drop down.

Thread.CurrentThread.CurrentCulture = new CultureInfo(strCulture);

2) We set the similar culture to the Resource class.

Resources.Resource.Culture = Thread.CurrentThread.CurrentCulture;

 3) Now we are all set to use the value.

lblUserId.Text = Resources.Resource.lblUserIdResource1.ToString();

lblPassword.Text = Resources.Resource.lblPasswordResource1.ToString();


Related Discussions:- Strongly typed resource class

What is the use of the connection object, What is the use of the Connection...

What is the use of the Connection object? The Connection object is used to connect your application to a specific data source by giving the needed authentication information in

What is windows workflow foundation, What is Windows Workflow Foundation (W...

What is Windows Workflow Foundation (WF)? Windows Workflow Foundation (WF) is a technology that was first introduced in .NET Framework 3.0. WF having of a programming model, a

Need to develop a simple .net software, Need to develop a simple .net softw...

Need to develop a simple .net software I am seeking someone who can design a customized software for me, prefrebly in .NET. I have a sql server backend which i would like to use

What is a parameter, What is a parameter? Explain the new types of paramete...

What is a parameter? Explain the new types of parameters introduced in C# 4.0. A parameter is a special type of variable, which is used in a function to give a piece of informa

Photohandler add-on to display file names, PhotoHandler add-on to display f...

PhotoHandler add-on to display file names Project Description: I want a website with a photo gallery using PhotoHandler. I need the code added/ modified to display the image

Explain the new features in ado.net entity framework 4.0, Explain the new f...

Explain the new features in ADO.NET Entity Framework 4.0. ADO.NET Entity Framework 4.0 is introduced in .NET Framework 4.0 and contain the following new features: Persisten

What is reflection, Reflection All .NET assemblies have metadata inform...

Reflection All .NET assemblies have metadata information stored  the types defined in the modules. And This metadata information can be accessed by mechanism called as "Reflect

Car (causal analysis and resolution), What is CAR (Causal Analysis and Reso...

What is CAR (Causal Analysis and Resolution)? The basic purpose of the CAR is to analyze all the problems, defects, and good practices/positive triggers in projects, perform a

Durkheims theory of crime, Application of durkheim''s theory of crime in ex...

Application of durkheim''s theory of crime in explaining the crime context in south Africa. Highlighting the relevance of the theory, as well as its limitations

Program for framework using microsoft visio, This assignment is based on le...

This assignment is based on lectures, tutorials, computer labs and research work. 1. Background During the lectures and tutorials on business process modeling and business

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd