private void btnshow_Click(object sender, EventArgs e) { try { int i = data_mail.CurrentRow.Index; DataGridViewRow a = data_mail.Rows[i]; string sid; string sname; string sidchannel; string smail; string sga; string snote; // gán giá ntri5 sid = a.Cells["id"].Value.ToString(); sname = a.Cells["Name"].Value.ToString(); sidchannel = a.Cells["idchannel"].Value.ToString(); smail = a.Cells["mail"].Value.ToString(); sga = a.Cells["ga"].Value.ToString(); snote = a.Cells["note"].Value.ToString(); Addnew show = new Addnew(sid, sname, sidchannel, smail, sga, snote, 2); show.ShowDialog(); } catch { } }
private void btnthem_Click(object sender, EventArgs e) { int c = layso(); c++; Addnew a = new Addnew(c, 1); a.ShowDialog(); if (!string.IsNullOrEmpty(id)) { DataRow r = dataset.Tables["data_trial"].NewRow(); r["id"] = id; r["Name"] = name; r["idchannel"] = idchannel; r["mail"] = mail; r["ga"] = ga; r["note"] = note; dataset.Tables["data_trial"].Rows.Add(r); MessageBox.Show("ok"); } // khởi tạo về ban đầu id = string.Empty; name = string.Empty; idchannel = string.Empty; ga = string.Empty; note = string.Empty; mail = string.Empty; }