For example, the letter G would choose GBP, letter U would choose USD etc.
I am trying to allow users to choose their currency when the form is open as shown below:
private void Ccy_Click(object sender, EventArgs e)
{
baseCcy1.Visible = true;
baseCcy1.Focus();
CcyForm c = new CcyForm((Button)sender, MousePosition.X, MousePosition.Y, _Ccy);
c.ShowDialog();
setBuySellButtons();
}
However, the textbox only focuses once the form is closed. It does not allow me to type in the textbox when the CcyForm is open. I have tried the async/await method with Task.delay, but this did not help. I do not wish to put the textbox in the CcyForm, but rather, be visible when form is open, and invisible when it is not.
How can I allow users to type in the textbox when the CcyForm is open? Thanks in advance!
You should call c.Show(this);
. That will create an owned form or modeless dialogue. That is a form that will always remain in front of its caller but will not block access to it. An example of an owned form is the VS Find & Replace dialogue.
baseCcy1.Show();
var c = new CcyForm((Button)sender, MousePosition.X, MousePosition.Y, _Ccy);
c.Show(this);
Activate();
baseCcy1.Select();