You're having problems with the variable i: first you're storing every txtName.Text in the same array-item (names[0] - that's not what you want but it's not the source of the error) and then you're increasing i (in btnshowNames) beyond the size of the array (= 100) before continuing with btnEntername where i is then too large (100) and you get the error. So, don't use a variable for more than one purpose at a time.
Let's rename i to index and your code should be:
private void btnEnterName_Click(object sender, EventArgs e)
{
if (index < names.Length)
{
names[index++] = txtName.Text;
txtName.Clear();
}
else
{
}
}
private void btnShowNames_Click(object sender, EventArgs e)
{
txtName.Clear();
foreach (string item in names)
{
txtNames.AppendText(item + Environment.NewLine);
}
}
Peter