Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
In VB.Net I noticed that the leave event for my textbox is firing up twice. On most occassions it would not matter but on some situations when I had to do some cumulative calculations the results would be wrong. It seems to be running okay using the lostfocus event, but when I was taking VB .Net training, it was recommended to use the leave event because that's a .Net framework event where as lostfocus is a VB 6 event. Please advise.
Posted

Describe the scenario. Are you exiting the form when you leave the textbox? I'm thinking the Leave event is being raised at the textbox level and then the form level.

 

You may also want to consider using the Validating event rather than the Leave event.

Posted

I am just trying to leave the textbox and move to the next one on the form and not closing the form. I don't know if it matters if the tab order would matter. With the tab orders, the immediate next control is a label, but that should not matter, right?

 

Describe the scenario. Are you exiting the form when you leave the textbox? I'm thinking the Leave event is being raised at the textbox level and then the form level.

 

You may also want to consider using the Validating event rather than the Leave event.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...