private void addbutton_Click(object sender, EventArgs e) { int StuID = Convert.ToInt32(this.SIDtextBox.Text); DataTable dt = cslStudent.GetStudents(StuID); this.SelectedStudentGridView.DataSource = dt; BindingSource bs = new BindingSource(); bs.DataSource = dt; int iRowCnt = this.SelectedContainersdataGridView.Rows.Count; string StudName = this. SelectedStudentGridView.Rows[iRowCnt].Cells[0].Value.ToString(); string Address = this. SelectedStudentGridView.Rows[iRowCnt].Cells[1].Value.ToString(); string Phone = this. SelectedStudentGridView.Rows[iRowCnt].Cells[2].Value.ToString(); PHTS.DataServices.cslStudent.NewStudent(StuID, StudName, Address, Phone); MessageBox.Show("Student Added Sucessfully"); }
Row
Cells
int n = grid.Rows.Add(); DataGridViewRow r = grid.Rows[n]; r.Cells[0].Value = ... ;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)