So, I wanna know how to write the entire content of an array to a textbox by using a foreach loop in C#. My code currently looks like this:
I generate a series of random numbers which are stored in the array:
int[] iData;
Now I want to write the stored data in this array to a textbox by using the foreach loop like this:
foreach (int myInt in iData)
{
txtListing.Text = myInt.ToString();
}
This will only write the last generated number in the array to the textbox, but my question is how do I write all of them to the tekstbox.
I only know, how to do this with a listbox and a forLoop. But is there any way this can be done with a textbox and a foreach loop?