Hi All,
I am working on a task pane in VBA.net and noticed during debugging that when a user clicks in a textbox control, types text, and then clicks into a ComboBox control, the TextBox control's leave, validating, and validated events do not fire until the user clicks into a different textbox control. If the user goes from a textbox to a combobox and back to the same textbox, these events still won't fire until a different control is entered.
So if I have TextBox1, TextBox2, and ComboBox:
1) If user clicks into TextBox1 then ComboBox: TextBox1's leave events do not fire
2) If user clicks into TextBox1 then ComboBox then TextBox1: Still no leave events firing
3) If user clicks into TextBox1 then ComboBox then TextBox2: TextBox1's leave events do fire
4) If user clicks into TextBox1 then ComboBox then TextBox1 then TextBox2: TextBox1's leave events fire at TextBox2
Could someone share some insight into why the textbox leave, validating, and validated events are put on hold for a combobox?
Sorry if this is a newbie question - having a hard time finding help with Google on this specific thing.
SolidworksApi/macros
Hi, that's weird.
Can you share a piece of code ? I have try that with a
And both of the events fire when I go to a combobox from a textbox :
Damn, I'm on Visual studio too. I joint my solution to see if this behave the same on your side. If you can, send me yours so I can test it.
haha oh good! =)
Im programming and debugging in Visual Studio
I have done the exact same thing (2 textbox and a combobox with Leave / Enter / Validated /Validating event for each)
and that's what I got :
(Click into TextBox1)
TextBox1_enter
(Click into TextBox2)
TextBox1_leave
TextBox1_validating
TextBox1_validated
TextBox2_enter
(Click into ComboBox1)
TextBox2_leave
TextBox2_validating
TextBox2_validated
ComboBox1_enter
(Click into TextBox1)
ComboBox1_leave
ComboBox1_validating
ComboBox1_validated
TextBox1_enter
we don't have the same behavior....
Are you using VSTA macro ? or Visual studio ?
Thanks for the reply, Jerome. I thought about it and originally decided not to post the code because all I did was add a debug.print with the event name at each control's enter, leave, validated, and validating events - just so I can see in the output window when exactly are they firing.
Private Sub Txttest1_Leave(sender As Object, e As EventArgs) Handles txttest1.Leave
Debug.Print("txttest1_leave")
End Sub
Private Sub Txttest1_Enter(sender As Object, e As EventArgs) Handles txttest1.Enter
Debug.Print("txttest1_enter")
End Sub
Private Sub Txttest1_Validated(sender As Object, e As EventArgs) Handles txttest1.Validated
Debug.Print("txttest1_validated")
End Sub
Private Sub Txttest1_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles txttest1.Validating
Debug.Print("txttest1_validating")
End Sub
and so on for Txttest2 and CboTest (for the latter I added a debug.print line at it's click event)
Here's my output window (with some comments in italics)
(Click into txttest1)
txttest1_enter
(Click into txttest2)
txttest1_leave
txttest1_validating
txttest1_validated
txttest2_enter
(Click into combobox, cbotest)
cbotest_click
(Click into txttest1)
txttest2_leave
txttest2_validating
txttest2_validated
txttest1_enter
For me, txttest2's leave, validating, and validated events only fire AFTER I click back into txttest1. If, instead of clicking back into txttest1, I click into txttest2 again, nothing happens until I click into txttest1 - so it appears at the outset that these events wait for the combobox to finish / exit AND a different control is entered before firing. I'm not clear why they wouldn't fire off before the combobox or at least why they have to wait until a different box is entered.
Hi, (my other post is being moderated). Can you share a piece of code here ? Leave Events are working fine on my end.