private async Task SearchByAmount() { ClearError(); FindButton.Enabled = false; ResultsDataGridView.DataSource = null; ResultsDataGridView.Rows.Clear(); ResultsDataGridView.Columns.Clear(); StartCountLoadingEffect(); string userSearchText = FindTextBox.Text.TrimEnd(); var success = Decimal.TryParse(userSearchText, out decimal result); if (success) { List<Invoice> invoices = await service.GetInvoicesByTranAmtAsync(result, (int)LimitNumeric.Value); PopulateDataGridView(invoices); } else { ErrorOccured("Error - Cannot convert input into number"); FindTextBox.Focus(); FindTextBox.Select(0, FindTextBox.Text.Length); CountLabel.Text = "0"; } FindButton.Enabled = true; }
private void KeyUpEventHandler(object sender, KeyEventArgs e) { if (ModifierKeys.HasFlag(Keys.Control) && e.KeyCode == Keys.F) { FindTextBox.Focus(); FindTextBox.Select(0, FindTextBox.TextLength); } }
private void FindTextBox_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { FindButton.PerformClick(); FindTextBox.Focus(); FindTextBox.Select(0, FindTextBox.TextLength); } }