Ich suchte online, um herauszufinden, wie Variablennamen automatisch dynamisch deklarieren und ich kam zu keinen Ergebnissen. mein Ansatz, um den Code ist, ich bin vereinfacht wie folgt:altnitives zum dynamischen deklarieren von Variablennamen automatisch in vb.net
dim choice1 as string
dim choice2 as string
dim choice3 as string
...
Ich wünschte, ich diese
dim count as integer
while count is 1 to 10
count +=1
end while
dim (choice+count) as string
' it suppose to create variable choice with the addition to the name from 1 to 10 like choice1, choice2, choice3 and so on.
wie folgt approch können Sie mir helfen können.
PS: Ich habe auch versucht, wie so in einem Array deklarierten Variablen zu erstellen:
dim count as integer
Dim var As Array = {Dim choice1 as string, dim choice2 as string}
while count is 1 to 10
var.add(dim choice+count as string)
end while