Discussion Thread
UniToolbox
Message Thread
The leading control suite for Unicode development in Visual Basic.
Posted in the UniToolbox Forum.
UniCombo not firing Validate events
I'm having some serious problems with my code because the UniCombo control is not firing Validate events i.e. if a control has the focus and I click a UnitCombo control the control's Validate event does not fire. CausesValidation is set to true for the UniCombo box. Other UniToolbox controls seem to fire Validate events as expected. Please help.
UniCombo not firing Validate events
The Validate event fires fine for me on my test form:
Private Sub UniCombo1_Validate(Cancel As Boolean)
MsgBox ("valid comb")
End Sub
UniCombo not firing Validate events
Here's how this bug can be demontrated in 5 minutes:
1) Add an ordinary VB text box to a form. Put the code Msgbox "Hello!" into the Validate event of the text box.
2) Add a UniCombo box control and an ordinary VB button to the form.
3) Run the form.
4) Click inside the textbox control and then click the Unicombo control. The textbox Validate event does not fire.
5) Click inside the textbox control and then click the button control. The Validate event fires as expected - 'Hello!' appears on the screen.
Can you confirm this as a bug? Is there a fix available for it?
UniCombo not firing Validate events
Thank you for your response.
It is not the Validate event of theUniCombo control that is the problem.
As you can see from my last post it is the Validate events of the other controls on the form that are not firing when the the UniCombo control is selected.
UniCombo not firing Validate events
Yes I understood that, it seems very hard to pin down exactly when this happens, as it's the interaction between the controls.
I suggest manually firing the Validation upon your button click as a workaround to the problem.
UniCombo not firing Validate events
I just created a test form from scratch to test the validation and the validation events occur for me in almost all instances, but re-clicking and realtering values seems occasionally to loose a validation event.
Currently we have no fix available for this and I suggest that you use a workaround to resolve the edge cases and sorry for the frustration caused.
UniCombo not firing Validate events
Unfortunately the Validation events are not firing at all for me.
I am going to try using the LostFocus event instead of the Validate event in each control. If the input validation fails then I can set the focus back to control to simulate the cancelling functionality of the Validate event. For example:
Private Sub tbox_LostFocus()
If Not IsNumeric(tbox.Text) Then
tbox.SetFocus
tbox.BackColor = vbRed
Else
tbox.BackColor = vbWhite
End If
End Sub
UniCombo not firing Validate events
I'm surprised that they're not firing at all for you, but I think your approach for the workaround is a sound idea. Sorry for any difficultycaused.