If you want to add the values from the
InputBox
to the array, then instead of a
foreach
loop, you can use a
for
loop.
for (int i = 0; i < Names.Length; i++)
{
string prompt = Interaction.InputBox("Please enter a string" , "Enter Strings");
Names[i] = prompt;
}