Ejemplo n.º 1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (this.counter <= this.second)
     {
         this.buttonOK.Text = string.Format("确定({0})", this.second - this.counter);
         this.Refresh();
         this.counter++;
     }
     else
     {
         this.timer1.Enabled = false;
         this.timer1.Stop();
         this.Close();
     }
     if (this.second - this.counter == 0)
     {
         // Application.Exit();
         if (MessageBox.Show("签到结束!!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             Form_checkIning a = new Form_checkIning();
             a.Visible = false;
         }
         else
         {
             this.Close();
         }
     }
 }
        public static string classRoom;//public类型的实例字段,static变量被所有对象所共有,也可以被所有对象所改变

        private void checkIningtoolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                int selectrow = this.dataGridView1.CurrentRow.Index;                        //所选行
                classRoom   = this.dataGridView1.Rows[selectrow].Cells[4].Value.ToString(); //所选行的第0列值
                strcourseid = this.dataGridView1.Rows[selectrow].Cells[1].Value.ToString();
                if (MessageBox.Show("进行课程签到?", "Confirm Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    Form_checkIning checkIn = new Form_checkIning();
                    checkIn.Show();
                }
                else
                {
                    this.Visible = true;
                }
            }
            else
            {
                this.Visible = true;
                MessageBox.Show("请选中课程后再进行签到!", "提示");
            }
        }