private void delBtn_Click(object sender, EventArgs e) { try { Convert.ToInt32(delamountField); if (delISBNField.Text == "") { MessageBox.Show("กรุณากรอกเลขประจำหนังสือ (ISBN)"); return; } Book b = new Book(delnameField.Text, "", "", "", "", "", delamountField.Text, "", "", delISBNField.Text, "", ""); DBCommand.delBook(b); } catch (FormatException e2) { MessageBox.Show("กรุณากรอกจำนวนเล่ม"); } }
private void delBtn_Click(object sender, EventArgs e) { try { if (delISBNField.Text == "") { MessageBox.Show("กรุณากรอกเลขประจำหนังสือ (ISBN)"); } Book b = new Book(delnameField.Text, "", "", "", "", 0, Int32.Parse(delamountField.Text), "", 0, delISBNField.Text, "", ""); DBCommand.delBook(b); } catch (FormatException e2) { if (delamountField.Text == "") { MessageBox.Show("กรุณากรอกจำนวนเล่ม"); } else if (Int32.Parse(delamountField.Text) <= 0) { MessageBox.Show("กรุณากรอกจำนวนเล่มที่ถูกต้อง"); } } }