简体   繁体   English

CodeGo.net>如何添加字符串资源?

[英]c# - How to add string to resources?

how to add the string to the resources. 如何将字符串添加到资源。 So when I restart the program that string should be in the resources. 因此,当我重新启动程序时,该字符串应位于资源中。 After when I add it how can I get it? 添加后,如何获得? For example: 例如:

textBox1.Text = // string that I've added;

Thanks... 谢谢...

Resources are not the right solution for your problem, they are designed to provide various (language) versions of constant strings. 资源不是解决您问题的正确解决方案,它们旨在提供各种(语言)版本的常量字符串。 Generating them during execution of the program is possible but not quite easy. 在程序执行期间生成它们是可能的,但不是很容易。 Even if you succeed to generate them, saving the file would be also hard - they are stored in the .exe or .dll file, which is probably locked as it is just executing. 即使成功生成它们,保存文件也很困难-它们存储在.exe或.dll文件中,该文件可能在执行时就被锁定了。

Use settings . 使用设置

Use settings they I've used them for a while and they work great. 使用他们使用了一段时间的设置,它们的效果很好。 If you want to change the setting you can do this: 如果要更改设置,可以执行以下操作:

Settings.Default.YourSetting = //Something
Settings.Default.Save();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM