フォームでは、ボタンをクリックするたびに、新しいテキストボックスが表示される必要があります。これらすべてのテキストボックスで配列を作成したいと思います。問題は、これらすべてのテキストボックスに動的な名前があることです。それらを配列に入れるにはどうすればよいですか? これが私のコードです:
Set nieuwtxtingredient = Me.Controls.Add("Forms.Textbox.1", "Ingredient", True)
With nieuwtxtingredient
.Width = Me.txtIngredient0.Width
.Height = Me.txtIngredient0.Height
.Left = Me.txtIngredient0.Left
.Top = Me.txtIngredient0.Top + 30 * aantalBoxes
.Name = "txtIngredient" + CStr(aantalBoxes)
End With
Dim naam As String
Dim ingredientArray() As String
ReDim ingredientArray(1 To aantalBoxes)
ingredientArray(aantalBoxes) = **Me.txtIngredient0.Value**