问题
i am having trouble with .net again. i have a series of 10 text boxes. I want to be able to populate them from an array and read there values into another array. In vb6 I would create a text box array with 10 text boxes / indices. I could then populate them by txtbox(i).text = arrVal(i) and to reference them arrVal(i) = txtbox(i). I am stumped I can create 10 text boxes on a form if I have to, but I want them somehow tied to each other as they were in vb6. Any help in how I could do this would be most appreciated
回答1:
Control arrays as available in VB6 are not supported in VB.NET. Not an issue, just create the array yourself:
Public Class Form1
Sub New()
InitializeComponent()
Boxes = New TextBox() {TextBox1, TextBox2, TextBox3}
End Sub
Private Boxes() As TextBox
End Class
来源:https://stackoverflow.com/questions/10695728/using-control-arrays