473,394 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Bind control property to resource string

Well, I'm using Windows Forms, not XAML.

I've got a resource file with dozens of strings. Now I have to bind those strings to control properties. I know that I can do it like this:


Expand|Select|Wrap|Line Numbers
  1.  System.Resources.ResourceManager resourceMan = new System.Resources.ResourceManager("TheProject.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly());
  2.  
  3.             button1.Text = resourceMan.GetString("Menu1");
But that's so boring. I've got so many strings. Can I do this using properties tab somehow?
There is a possibility of binding properties to Settings. Is there a possibility to bind properties to resource strings?
Apr 21 '09 #1
2 2759
Frinavale
9,735 Expert Mod 8TB
Yes you can.

First of all you could use Local Resources for each of your forms. This will automatically do stuff for you.

If you really want to use a Global Resource you'll have to come up with some sort of naming convention for your Form elements (controls). Once you have this, you can use Reflection to retrieve the element names and pass that as the key to your Global Resource.
Apr 22 '09 #2
Could you point me more exactly to any of these ways?
Apr 22 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dberlin | last post by:
Hi, I'm building a modest GUI editor for myself using wxPython, and I need some help. I want to create a nice 'Control Property Editing Window', just like VisualBasic, Delphi, Visual C++, etc....
1
by: Peter Strøiman | last post by:
Hi. I have a web project, that is intended to be installed multiple times as different product with different names. All strings in the web are placed in local resource files. In some of the...
0
by: Cordine | last post by:
i've got a class, with a public property cName (string). i've instantiated the class, & when i try to execute the following piece of coding, Me.TextName.DataBindings.Add(New Binding("Text",...
16
by: David Gacek | last post by:
Anyone know how to ... make a user control property that shows up in the property pages and allows one to select a value from a set of values ? like a combobox for example ?
2
by: Maileen | last post by:
Hi, I'm used under C++ to write a DLL which contain all my resource strings used in my application. I would like to continue in this way under VB.NET. Please, could you tell me how to create a...
1
by: theintrepidfox | last post by:
Dear Group I'd be grateful if one of you can help me out with the following. I'd like to load a resource string dynamically e.g. Resources.Default.aspx.mnuNavigation1 should load the...
0
by: Robf | last post by:
Is there a way to add browse capability to a server control property? Example: I have a Image Property which expects a string parameter for the location and name of the Image - at run time I...
0
by: uwe.braunholz | last post by:
Hello, I want to enable/disable some Textboxes by a property of a derived BindingSource-class. This is what i got so far: ---- class myBindingSource : BindingSource { public object mxtest =...
1
by: shapper | last post by:
Hello, I have a class where I created various controls. One of the controls have a property which is a generic list of WebControl. Then in web site page I have something like: Dim a As New...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.