1

I'm creating a windows forms application. I have all of my resource strings (resx files) in its own project within the solution. Is it possible to reference those resource files at design time?

Coming from web (ASP.Net MVC) we were able to add a reference in the view to the resource file(s) we needed. Am I able to do something similar and set the labels at design time?

stuartd
  • 70,509
  • 14
  • 132
  • 163
TeddyRuxpin
  • 99
  • 1
  • 12
  • It is a built-in feature, but you'll have to get *started* with setting the Localizable property to True, *then* set the Text properties (and others). These properties get stored in the form's .resx file. – Hans Passant Sep 08 '11 at 16:05
  • is it possible to point to the resource files in the other project? – TeddyRuxpin Sep 08 '11 at 16:15
  • The odds that a .resx file that was created in another project matches the one needed by a form are sufficiently close to zero to not contemplate that. Even if you do get it to work, it will be an unmaintainable pita for years to come. – Hans Passant Sep 08 '11 at 16:20
  • by other project, i mean a project in the solution. I centralize all resource files in one project and reference them from my ui, bll, etc... they contain error messages, labels, other text, etc... the strategy(DRY) has worked well for me in the web space. sadly, doesn't seem to work so well in win forms. – TeddyRuxpin Sep 08 '11 at 16:29
  • A Winforms aspect that is often overlooked is that its designer is a *code generator*. So, yes, DRY is no concern, nobody cares about the quality of auto-generated code. – Hans Passant Sep 08 '11 at 16:58
  • this really makes me sad :(... thanks for info HP :). so is it standard practice to enable localization and have the form generate the resx file and then create files for other languages? – TeddyRuxpin Sep 09 '11 at 12:40

1 Answers1

1

Not unless you are prepared to go down the route of using Localizable forms - see WinForms strings in resource files, wired up in designer

Community
  • 1
  • 1
stuartd
  • 70,509
  • 14
  • 132
  • 163