private void txtSearchValue_TextChanged(object sender, EventArgs e) { if (txtSearchValue.Text == "") { SelectedType(); } else { string property = cbSearchAttr.SelectedValue.ToString(); string value = txtSearchValue.Text; string TableName = cbTable.SelectedItem.ToString(); switch (TableName) { case "Customers": { DisplayTable(cbSearchAttr, dtgvTable, Customers, Customer.GetCustomerFromProperty(property, value)); break; } case "Drinks": { DisplayTable(cbSearchAttr, dtgvTable, Drinks, Drink.GetDrinkFromProperty(property, value)); break; } case "Elements": { DisplayTable(cbSearchAttr, dtgvTable, Elements, Element.GetElementFromProperty(property, value)); break; } case "Employees": { DisplayTable(cbSearchAttr, dtgvTable, Employees, Employee.GetEmployeeFromProperty(property, value)); break; } case "ImportBills": { DisplayTable(cbSearchAttr, dtgvTable, ImportBills, ImportBill.GetImportBillFromProperty(property, value)); break; } case "ExportBills": { DisplayTable(cbSearchAttr, dtgvTable, ExportBills, ExportBill.GetEmployeeFromProperty(property, value)); break; } case "Jobs": { DisplayTable(cbSearchAttr, dtgvTable, Jobs, Job.GetJobFromProperty(property, value)); break; } case "Suppliers": { DisplayTable(cbSearchAttr, dtgvTable, Suppliers, Supplier.GetSupplierFromProperty(property, value)); break; } case "Accounts": { DisplayTable(cbSearchAttr, dtgvTable, Accounts, Account.GetAccountFromProperty(property, value)); break; } } } }