private void buttonSearch_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; AM = new AllMethodsClass(); resultList = new List <PropertyClass>(); int userKey = 0; if (!string.IsNullOrEmpty(textBoxSearch.Text)) { int cDbKey = 0; if (string.IsNullOrEmpty(comboBoxCatagory.Text)) { UtilityOperations.showMessage("Please select some category"); } else { if (newCategoryList.ContainsKey(comboBoxCatagory.Text)) { cDbKey = Convert.ToInt32(newCategoryList[comboBoxCatagory.Text]); } if (checkBoxAllorMine.Checked) { userKey = UtilityOperations.getUserKey(); } else { userKey = 0; } resultList = AM.getResultList(textBoxSearch.Text, cDbKey, userKey); } } else { UtilityOperations.showMessage("Please enter the search text"); } loadDataGrid(); foreach (PropertyClass pClass in resultList) { dataGridViewResult.Rows.Add(pClass.Id, pClass.Title, pClass.ArticleType, pClass.URL); } Cursor.Current = Cursors.Default; }