Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我又遇到了.net 的问题。我有一系列 10 个文本框。我希望能够从一个数组中填充它们并将那里的值读入另一个数组。在 vb6 中,我将创建一个包含 10 个文本框/索引的文本框数组。然后我可以通过 txtbox(i).text = arrVal(i) 填充它们并引用它们 arrVal(i) = txtbox(i)。我很难过,如果必须的话,我可以在一个表单上创建 10 个文本框,但我希望它们以某种方式相互关联,就像它们在 vb6 中一样。对于我如何做到这一点的任何帮助将不胜感激
VB.NET 不支持 VB6 中可用的控件数组。没问题,只需自己创建数组:
Public Class Form1 Sub New() InitializeComponent() Boxes = New TextBox() {TextBox1, TextBox2, TextBox3} End Sub Private Boxes() As TextBox End Class