Pacman
Pacman

Reputation: 2245

move MenuStrip item text into resource file

I am using .NET WinForms (C#) I have a form with a menustrip control in it, I added menu items in the designer and assigned test to them, now I want to move this text into a resource file. how do I do that ?

Upvotes: 0

Views: 545

Answers (2)

Mr. WillKiss
Mr. WillKiss

Reputation: 21

  1. Project > Add New Item > Resourece File
  2. Add string in resource...
  3. Open your FormDesigner.cs, find and replace Text to this.stripItem.Text = global::your_app_namespace.resource_name.resource_value;

Upvotes: 0

Raj Ranjhan
Raj Ranjhan

Reputation: 3917

You can use Resourcemanager to set the string of the MenuItem.

So you can have something like:

MenuItem topLevel = mainMenu.MenuItems.Add("&XXX");
MenuItem first = new MenuItem();
first.Text = [Text from ResourceManager]
topLevel.MenuItems.Add(new MenuItem("&New"));

Upvotes: 1

Related Questions