private void SearchButton_Click(object sender, EventArgs e) { try { item.FromDate = Convert.ToDateTime(fromDate.Text); item.ToDate = Convert.ToDateTime(toDate.Text); if (item.FromDate > item.ToDate) { MessageBox.Show("From date must be less then or equal to todate!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); fromDate.Focus(); return; } if (soldRadioButton.Checked) { item.StockOutType = "Sell"; } if (damageRadioButton.Checked) { item.StockOutType = "Damage"; } if (lostRadioButton.Checked) { item.StockOutType = "Lost"; } var items = _stockOutManager.GetItemsByDateAndOutTpe(item); if (items.Count <= 0) { MessageBox.Show("No data found!", "Not found", MessageBoxButtons.OK, MessageBoxIcon.Information); } BindItemsGridView(items); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }