0
I have a function that records some information in a table when leaving a TextBox
(Leave). But when leaving, the focus returns to the first TextBox
. When this occurs it directs the focus as it should, but reinserts the line in the bank with the same information (duplicates). What can I do to adjust?
I’m doing it this way:
public void InsereDados()
{
//Pega o valor dos campos e insere no banco
}
public void AtualizaGrid()
{
//Atualiza as informações no Grid
}
private void Tbnome_Leave(object sender, EventArgs e)
{
InsereDados();
AtualizaGrid();
//Volta o Foco para o Primeiro TextBox
TbCod.Focus();
}
The first
TextBox
has some code in the eventEnter
? If yes which ?– Isac
Only on Leave, but I’ve tried to focus on others who have no event and the same thing happens.
– Ralf
Somehow the event Leave is not being executed twice? If you put a breakpoint in the first line of the event, there passes there a second time?
– João Martins
The
TextBox
must be with theAutoPostBak="true"
– Leandro Angelo
I traded the Leave event for Validating and it worked. Thank you all for your help.
– Ralf