public void SearchData() { Cursor.Current = Cursors.WaitCursor; string strSearchCustomer; string strInternalItem; string strExternalItem; string strSearchUseYN; try { strSearchCustomer = lueSearchCustomer.Properties.GetKeyValueByDisplayText(lueSearchCustomer.Text).ToString(); if (string.IsNullOrEmpty(strSearchCustomer)) { strSearchCustomer = "%"; } strInternalItem = txtSearchItemInternal.Text.Trim(); if (string.IsNullOrEmpty(strInternalItem)) { strInternalItem = "%"; } strExternalItem = txtSearchItemExternal.Text.Trim(); if (string.IsNullOrEmpty(strExternalItem)) { strExternalItem = "%"; } strSearchUseYN = lueSearchUseYN.Properties.GetKeyValueByDisplayText(lueSearchUseYN.Text).ToString(); if (string.IsNullOrEmpty(strSearchUseYN)) { strSearchUseYN = "%"; } var qry = db.stp_ItemByCustomer_Select(strSearchCustomer, strInternalItem, strExternalItem, strSearchUseYN); if (qry != null) { gcList.DataSource = qry.ToList(); if (gvList.RowCount > 0) { AddDropDown(); gvList.FocusedRowHandle = -1; string[] arr = { "CustomerCode", "ItemID", "ItemNumberID", "ItemType", "ItemDetailID" }; Functions.SetInvisible(ref gvList, arr); gvList.BestFitColumns(); gvList.OptionsBehavior.Editable = false; gvList.FocusedRowHandle = 0; } } else { MessageBox.Show("No Results", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { string errMsg; if (ex.InnerException == null) { errMsg = ex.Message.ToString(); } else { errMsg = ex.InnerException.ToString(); } XtraMessageBox.Show("Couldn't Search Item By List!" + Environment.NewLine + errMsg, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { Cursor.Current = Cursors.Default; } }