private void Savebutton_Click(object sender, EventArgs e) { studentName = StudentNametextBox.Text; contactNumber = ContactNumbertextBox.Text; emailAddress = EmailAddresstextBox.Text; Student studentObj = new Student( StudentNametextBox.Text, ContactNumbertextBox.Text , EmailAddresstextBox.Text); ListViewItem item = new ListViewItem(); item.Tag = studentObj; item.Text = studentObj.StudentName_; item.SubItems.Add(studentObj.ContactNumber_); item.SubItems.Add(studentObj.EmailAddress_); StudentlistView.Items.Add(item); ClearTextBox(); }
private void StudentlistView_DoubleClick(object sender, EventArgs e) { ListViewItem selectedListViewCell = StudentlistView.SelectedItems[0]; selectedStudent = (Student)selectedListViewCell.Tag; SetDataInTextBoxes(); selectedRowIndex = StudentlistView.SelectedIndices[0]; Savebutton.Visible = false; Cancelbutton.Visible = true; Updatebutton.Visible = true; }
private void Updatebutton_Click(object sender, EventArgs e) { Student StudentObj = new Student(StudentNametextBox.Text, ContactNumbertextBox.Text, EmailAddresstextBox.Text); ListViewItem item = new ListViewItem(); item.Tag = StudentObj; item.Text = StudentObj.StudentName_; item.SubItems.Add(StudentObj.ContactNumber_); item.SubItems.Add(StudentObj.EmailAddress_); StudentlistView.Items[selectedRowIndex] = item; MakeOperationForSaveButton(); }