Hi,
I have an issue where my custom user control, when placed on a group box, does not apply its validate event correctly (i.e. cancel = True to stop focus move). When the control is placed on a frame or on the form it validates correctly.
I'm using version 13.4.2 but have tried it on 15.0.2.
The issue only manifests itself when the control is on a GroupBox AND the button is a PushButton. If either or both are standard VB6 controls then there is no issue.
The event order when the frame is a VB6 frame and button is standard or codejock is TestControlFrame: UserControl_EnterFocus TestControlFrame: txtData_GotFocus TestControlFrame: txtData_Validate
But the event order when the frame is codejock and the button is standard or codejock is TestControlGroupBox: UserControl_EnterFocus TestControlGroupBox: txtData_GotFocus TestControlGroupBox: txtData_LostFocus TestControlGroupBox: UserControl_ExitFocus TestControlGroupBox: txtData_Validate TestControlGroupBox: UserControl_EnterFocus TestControlGroupBox: txtData_GotFocus
The difference with this one however is that the codejock push button will execute the VB6 one will not.
I think that it is something to do with the CausesValidation property. Its like the group box is killing it.
I cannot use the standard VB6 frame however as the codejock group box fixes an intermittent paint issue when clicking on a frame and custom controls disappearing. I also cannot replace the buttons as they all have icons now.
I've attached a very simple example of this in action. uploads/7217/ControlValidationIssue.zip - uploads/7217/ControlValidationIssue.zip Note. Do not click between the user controls as this will get stuck in a validation loop. Note. The user control and app must be compiled (and run using this) to correctly highlight the issue.
I've tried placing the button in a frame, groupBox and pictureBox but this had no effect. I also tried placing the usercontrol text box which does the validation in a frame, groupBox and pictureBox as well.
Has anyone got any ideas?
This is for an app where a custom user control is used to force correct selection of data. We're starting to get lots of issues on our support desk where users have managed to enter invalid data because of this. Its taken me three days to figure this out so I'd take any solution at the moment :o) (Other than replace all the pushButtons / GroupBoxs)
|