Kiarash
Kiarash

Reputation: 1889

How to Manage Messages of my application

I currently use a the databse to store my messages but I guess there should be a better way any idea can help me ?

I mean thoese messages I provide for user in the UI,

Example : "Data Saved Successfully" or "Are You Sure to delete?"

Upvotes: 1

Views: 225

Answers (3)

Shyju
Shyju

Reputation: 218732

You can either use resource files or store them in a database and load your labels into a dictionary object when the app loads and read from that each time when you need the label. Having them in the table allows you to change the label when you want to do so without redeploying the assembly.

Upvotes: 0

Gerald Davis
Gerald Davis

Reputation: 4549

In a resource file.

You can create resource file manually or you can use visual studio to assist you. Right click project > Properties > Resources.

There you can setup name value pairs of strings.

i.e. msgSaved "Saved Sucessfully" msgSure "Are You sure?"

Once defined you can access resources from the resource file using resource manager. http://www.dreamincode.net/code/snippet1683.htm

Upvotes: 2

xandy
xandy

Reputation: 27411

Define them in XML and compiled them as Resource file.

Then use ResourceManager to gain access to it.

Upvotes: 1

Related Questions