1
When starting my project WinFormsi define focus on a component lookUp Edit of DevExpress who owned an event Leave. The goal of this focus is to make target selection mandatory. The initial value of this component is null and is filled in with bank data. When you click on another element, for example: a menu that is in the main form, an alert is displayed but this is in loop. I need that after clicking on another element, the alert is displayed and the focus is back on lookup Edit destino.
In my view, the loop happens because the default target value is = null and after the return it ends up falling into the same condition. But I couldn’t find a way to fix it
The default value of the variable Encerrar é false and the component standard value destino é null
How can I resolve this? Below is a fragment of the code.
private void Destino_Leave(object sender, EventArgs e)
{
if (!Encerrar)
{
if (destino.EditValue == null)
{
MessageBox.Show("Selecione um Destino");
ActiveControl = destino;
destino.Focus();
return;
}
LugarDestino = destino.EditValue.ToString();
...restante do código...
}
}
Destino_Leaveappears to be an event handler. Of what object this handler signed and what event (who issender)? That actionLeaveis the equivalent ofLostFocusof the default controls?– Diego Rafael Souza