private void searchButton_Click(object sender, EventArgs e) { try { String price1 = price1TextBox.Text; String price2 = price2TextBox.Text; if (String.IsNullOrEmpty(price1) || String.IsNullOrEmpty(price2)) { MessageBox.Show("Insert price range!"); return; } List <Mobile> mobiles = _mobileManager.SearchMobileByPrice(price1, price2); if (mobiles != null) { showMobileGridView.Columns.Clear(); showMobileGridView.Columns.Add("SerialNumber", "SI#"); showMobileGridView.DataSource = mobiles; } else { showMobileGridView.Columns.Clear(); MessageBox.Show("No Data found!!"); return; } } catch (Exception exception) { MessageBox.Show(exception.Message); _mobileManager.CloseConnection(); } }