In my Windows Forms applications I often put the controls' text data (form title, labels texts, button captions, etc.) into a .settings
(feature automatically generated by Visual Studio - based on the ApplicationSettingsBase
class). In particular,
The good point of this is that all my text data is collected in one place and is easy to check and edit. Also it is convenient when I want to use the same text for several controls.
However, I haven't heard that somebody uses the .settings
such way. In tutorials for creating multilingual applications, for example, it is recommended to enter texts directly into the control property.
So, is it good practice to use .settings
for storing controls text data?
Brief conclusion from the answers:
Storing controls text data in the .settings is not common practice.
Use the settings to remember things for the user, like window size, location, state (minimized, maximized, normal), currently selectedItem of comboboxes, checked state of checkboxes, etc. Things that can be bound and automatically reset for the user the next time he/she runs the program.
Button text belong in resource files to simplify localization if needed.
This kind of data belongs in the application's resource file(s). That way they can be localized.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.