创建计数器以添加学生 [英] create the counter to add students

查看:87
本文介绍了创建计数器以添加学生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我必须在Windows窗体中创建一个计数器,在其中可以添加今天参加特定学科课程的现有学生.


在此先感谢

Hi all,
i have to create a counter in a windows form where i can add todays available students who have attended particular subject class.


Thanks in advance

推荐答案

此代码假定您已经具有带有按钮(Button1)和标签(Label1)的表单(Form1).
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();
    }
}


然后,每次有新学生进入课程时,您都可以单击按钮.上完课后,Label1中会显示学生人数.


如果您搜索完全不同的内容,请使用改善问题"链接来重新表述您的问题.


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.


这篇关于创建计数器以添加学生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆