private void UpdateBook_Load(object sender, EventArgs e) { txtISBN.Text = book.ISBN; txtName.Text = book.Name; txtPrice.Text = book.Price.ToString(); txtQuantity.Text = book.Quantity.ToString(); txtDesc.Text = book.Description; txtPrice.Text = book.Price.ToString(); txtStatus.Text = book.Status; for (int i = 0; i < ListAuthors.Items.Count; i++) { int count = 0; for (int t = count; t < book.Author.Count; t++) { if (book.Author[t].ID == ((AuthorData)ListAuthors.Items[i]).ID) { ListAuthors.SetSelected(i, true); count = t; break; } } } for (int i = 0; i < ListCategory.Items.Count; i++) { for (int t = 0; t < book.Category.Count; t++) { if (((CategoryData)ListCategory.Items[i]).ID == book.Category[t].ID) { ListCategory.SetSelected(i, true); break; } } } for (int i = 0; i < cboPublisher.Items.Count; i++) { if (book.Publisher_ID == ((PublisherData)cboPublisher.Items[i]).ID) { cboPublisher.SelectedIndex = i; } } }