在My.Resources中读写字符串

时间:2014-01-17 10:01:18

标签: .net vb.net string resources

我在考虑使用这个:
enter image description here
我怎样才能保存以下内容:

Dim sometext As String = TextBox1.Text
My.Resources.Add.Name("foo")
My.Resources.Add.ValueTo("foo") = sometext
' hope you get what I meant.  

基本上,我想将它用作数据库或其他东西..用于保存按钮的名称和位置..谢谢!

1 个答案:

答案 0 :(得分:3)

你不能,My.Resources是只读的。

您使用My.Resources为项目添加资源(如图像,音频,文本和其他任何内容),这样当您编译时,这些资源就会嵌入到应用程序中。这样做有几个原因,但我想到的是:

  1. 您可以使用它来存储可能会改变位置的内容(例如图像)
  2. 因为它是应用程序的一部分,用户无法删除/移动它,否则会破坏您的应用程序。
  3. 更多信息:http://msdn.microsoft.com/en-us/library/6wkcc526%28v=vs.100%29.aspx