예제 #1
0
        private void btnnew_Click(object sender, EventArgs e)
        {
            FormStudent fs = new FormStudent();

            fs.ShowDialog();
            FormDataGridStudent_Load(null, null);
        }
예제 #2
0
        private void btnedit_Click(object sender, EventArgs e)
        {
            string  ed = dgvstu[0, dgvstu.CurrentRow.Index].Value.ToString();
            Student s  = new Student();

            s.stid = int.Parse(ed);
            DataTable   dt = s.selectone();
            FormStudent fs = new FormStudent();

            fs.txtid.Text      = dt.Rows[0]["stid"].ToString();
            fs.txtname.Text    = dt.Rows[0]["stname"].ToString();
            fs.txtfamily.Text  = dt.Rows[0]["stfamily"].ToString();
            fs.txtaddress.Text = dt.Rows[0]["staddress"].ToString();
            fs.txttell.Text    = dt.Rows[0]["sttell"].ToString();
            fs.txtgender.Text  = dt.Rows[0]["stgender"].ToString();
            fs.txtfield.Text   = dt.Rows[0]["fid"].ToString();
            fs.txtid.ReadOnly  = true;
            fs.btninsert.Text  = "ویرایش";
            fs.ShowDialog();
            FormDataGridStudent_Load(null, null);
        }