This code assumes that you already have a form (Form1) with a button (Button1) and a label (Label1).
public class Form1 : Form
{
private int _studentsSoFar = 0;
private void Button1_Click(object sender, EventArgs e)
{
_studentsSoFar++;
Label1.Text = _studentsSoFar.ToString();
}
}
You can then click the button every time a new student enters the class. When class is over, the amount of students is displayed in Label1.
If you search for something completely different, please rephrase your question using the "Improve question" link.