public void ShowData(clsThiSinh ts) { tbMaSo.Text = ts.MaSo; tbHoTen.Text = ts.HoTen; cbDiemToan.Text = ts.DiemToan.ToString(); cbDiemLy.Text = ts.DiemLy.ToString(); cbDiemHoa.Text = ts.DiemHoa.ToString(); tbDiemTrungBinh.Text = ts.DiemTrungBinh.ToString(); tbKetQua.Text = ts.KetQua; }
void BtSuaClick(object sender, EventArgs e) { thisinh.MaSo = tbMaSo.Text; thisinh.HoTen = tbHoTen.Text; source[dgThiSinh.CurrentRowIndex] = thisinh; //source.Add(thisinh); thisinh = new clsThiSinh(); ClearData(); dgThiSinh.Refresh(); }
void BtAddClick(object sender, EventArgs e) { thisinh.MaSo = tbMaSo.Text; thisinh.HoTen = tbHoTen.Text; source.Add(thisinh); //dsThiSinh.Add(thisinh); //dgThiSinh. //dgThiSinh.DataSource = dsThiSinh; thisinh = new clsThiSinh(); ClearData(); dgThiSinh.Refresh(); }
void BtXoaClick(object sender, EventArgs e) { try { clsThiSinh currentThiSinh = (clsThiSinh)source[dgThiSinh.CurrentRowIndex]; source.RemoveAt(dgThiSinh.CurrentRowIndex); // JavaScriptSerializer serializer = new JavaScriptSerializer(); // var json = serializer.Serialize(currentThiSinh); // MessageBox.Show(json); // // var deserializeObject = serializer.Deserialize<clsThiSinh>(json); // clsThiSinh newThiSinh = (clsThiSinh)deserializeObject; // ShowData(newThiSinh); }catch (Exception ex) { MessageBox.Show(ex.ToString()); } }