private void bAddBook_Click(object sender, EventArgs e) { FormBook iFormBook = new FormBook(OpenMode.NEW); DialogResult iDR = iFormBook.ShowDialog(); if (iDR == DialogResult.OK) { this.lbBooks.Items.Add(iFormBook.ActBook); } }
private void bEdit_Click(object sender, EventArgs e) { if (this.lbBooks.SelectedIndex != -1) { FormBook iFormBook = new FormBook(OpenMode.EDIT); iFormBook.ActBook = (Book)lbBooks.Items[lbBooks.SelectedIndex]; DialogResult iDR = iFormBook.ShowDialog(); if (iDR == DialogResult.OK) { this.lbBooks.Items.Insert(this.lbBooks.SelectedIndex, iFormBook.ActBook); this.lbBooks.Items.RemoveAt(this.lbBooks.SelectedIndex); } } }
private void viewBook_Click(object sender, EventArgs e) { if (this.lbBooks.SelectedIndex != -1) { FormBook iFormBook = new FormBook(OpenMode.VIEW); iFormBook.ActBook = (Book)this.lbBooks.Items[this.lbBooks.SelectedIndex]; iFormBook.ShowDialog(); } }