Hi, I have to create an application that will take the names of 4 friends from a text box (one at a time).
How do I make it so the current text gets inserted to the next free space on the array.
Thanks
Q: Create a program in C# that declares an array with 4 elements. The program should then insert the names of four of your friends into the array, and output all elements to the screen, from index 0 to 3, using afor loop
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace exam_review
{
public partial class Form1 : Form
{
string[] namesString = new string[4];
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
for(int counterInteger = -1;counterInteger = 3;counterInteger++)
{
}
foreach (string allString in namesString)
{
}
}
}
}