private void button1_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1 && comboBox1.Text != "") { if (submissiondatetb.BackColor == Color.Red) { MessageBox.Show("Fine : " + fine + " PKR\nSubmission Delay : " + days + " days\nPer Day Fine : 50 PKR " + lc.receiveBook(Convert.ToInt32(dataGridView1.SelectedCells[0].Value), Convert.ToInt32(comboBox1.SelectedValue))); } else { MessageBox.Show(lc.receiveBook(Convert.ToInt32(dataGridView1.SelectedCells[0].Value), Convert.ToInt32(comboBox1.SelectedValue))); } comboBox1.DataSource = null; comboBox1.Text = ""; } else { MessageBox.Show("Please Select any Book and Customer First", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }