[英]How to save user inputted value in TextBox?
我有一个文本框,它要在关闭后保存,然后提供给另一台计算机。
Public Class Form1
Dim textBoxes() As TextBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
textBoxes = New TextBox() {TextBox2}
With My.Settings
If .TextBoxValues Is Nothing Then .TextBoxValues = New System.Collections.Specialized.StringCollection
For i = 0 To textBoxes.Length - 1
If .TextBoxValues.Count <= i Then .TextBoxValues.Add("")
textBoxes(i).Text = .TextBoxValues(i)
Next
End With
在设置中,我有一个名为TextBoxValues的设置
system.collections.specialized.stringcollection
然后,它适用于Scope User,但如果应用程序被移动或分配给另一台计算机,则不会保存。 所以我必须将范围更改为“应用”。 但是,当我将其转到应用程序时,出现此错误:
属性“ TextBoxValues”为“ ReadOnly”。 对于
.TextBoxValues = New System.Collections.Specialized.StringCollection
我认为您必须保存为txt文件,XML或somethig ..
因为以其他方式如何保留dtat类型的数据? :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.