所以我试图创建一个 8X8 的文本框网格。当我需要搜索文本框时,我希望能够访问它们。我考虑过考虑嵌入列表(即 List>
),其中内部列表有 8 个插槽,外部列表也有 8 个。我想知道是否有更简单的方法。
另外,我如何将表单中的文本框添加到这个二维数组中?
感谢您的帮助。
-刘易斯
So I'm trying to create an 8X8 grid of textboxes. I want to have the ability to also access the textboxes when I need to search through them. I have looked into considering an embedded List (i.e. List<List<TextBoxes>>
) Where the inner list has 8 slots and the outer lists also has 8. I was wondering if there was an easier way.
Also how would I add my textboxes from my form into this 2d array?
Thanks for the help.
-Lewis
发布评论
评论(3)
您可以使用
TextBox[,]
来实现此目的:然后您可以将
textbox00
访问为textboxes[0,0]
,textbox56
作为textboxes[5,6]
等。You could use a
TextBox[,]
for this purpose:Then you can access
textbox00
astextboxes[0,0]
,textbox56
astextboxes[5,6]
, etc.试试这个:
要访问第四行的第三个文本框,您可以使用:
try this:
To access thrid textbox in fourth row, you can use:
使用标准二维数组 TextBoxes[8,8]
Use a standard 2D array TextBoxes[8,8]