private void SearchForGivenAccountNumber() { if (txt_AccountNumber.Text == "" && txt_AccountName.Text == "" && cb_AccountTypeName.Text == "") { GridRefresh(); } else if (txt_AccountNumber.Text != "") { if (txt_AccountNumber.Text.Length <= GeneralFunctions.AccountNumberLenght) { if (GeneralFunctions.CheckSubstring(txt_AccountNumber.Text)) { currentAccountNumber = GeneralFunctions.ApplyAccountFormat(txt_AccountNumber.Text); DataView dv = new DataView(dbAccountingProjectDS.GLAccounts); dv.RowFilter = CreateFilterExpression(); dgv.DataSource = dv; dgv.Refresh(); } else { MessageBox.Show("The Account Number can only contain numeric characters \n Please Insert valid characters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("The lenght of the given account exceeds the lenght of the input account format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (cb_AccountTypeName.Text != "") { DataView dv = new DataView(dbAccountingProjectDS.GLAccounts); dv.RowFilter = CreateFilterExpression(); dgv.DataSource = dv; dgv.Refresh(); } else if (txt_AccountName.Text != "") { DataView dv = new DataView(dbAccountingProjectDS.GLAccounts); dv.RowFilter = CreateFilterExpression(); dgv.DataSource = dv; dgv.Refresh(); } }