public int AddStu(Stusent stu) { if (amount > 50) { MessageBox.Show("the array is full"); return(0); } student[amount] = stu; amount++; return(1); }
public int AddStu(Stusent stu) { if (amount > 50) { MessageBox.Show("the array is full"); return 0; } student[amount] = stu; amount++; return 1; }
private void buttonAdd_Click(object sender, EventArgs e) { //String Id, Name, Class; //float chinese, math, english; //float all; Stusent student=new Stusent(); student.id = Convert.ToString(textBoxID.Text); student.name = Convert.ToString(textBoxName.Text); student.Class = Convert.ToString(textBoxClass.Text); student.chinese = Convert.ToSingle(textBoxChinese.Text); student.math = Convert.ToSingle(textBoxMath.Text); student.english = Convert.ToSingle(textBoxEnglish.Text); student.all = student.chinese + student.english + student.math; int i = studentlist.AddStu(student); labelAllpoint.Text = Convert.ToString(i); }
private void buttonAdd_Click(object sender, EventArgs e) { //String Id, Name, Class; //float chinese, math, english; //float all; Stusent student = new Stusent(); student.id = Convert.ToString(textBoxID.Text); student.name = Convert.ToString(textBoxName.Text); student.Class = Convert.ToString(textBoxClass.Text); student.chinese = Convert.ToSingle(textBoxChinese.Text); student.math = Convert.ToSingle(textBoxMath.Text); student.english = Convert.ToSingle(textBoxEnglish.Text); student.all = student.chinese + student.english + student.math; int i = studentlist.AddStu(student); labelAllpoint.Text = Convert.ToString(i); }