Forms Public Class Main Class Shared Sub Main() Dim form1 As Form = New Form1 Application. Initialize Component() 'Add any initialization after the Initialize Component() call End Sub 'Form overrides dispose to clean up the component list. New() 'This call is required by the Windows Form Designer. Click Here to read that article and then return to this one. For example, this might come in handy if you had a two stage validation. A call to Validate can be triggered by code elsewhere, but it still doesn't trigger the Validating and Validated events as shown below.--------Click Here to display the illustration--------The second is to call Validate from a container control where the controls that you want validated are child controls.Implicit validation occurs when Auto Validate for the form is set to Enable Prevent Focus Change (the default) or Enable Allow Focus Change. But each control has a Validating and Validated event with a Console. Here's a partial snippet: Private Sub Text Box1_Validating( By Val sender As Object, By Val e As System. In this simple example, the only candidate is the main form. To illustrate the principal, I've coded a call to the Validate method from the Click event of the form.--------Click Here to display the illustration--------(Keep in mind that this only happens when Auto Validate is Disable.)The other Validate overload passes a boolean. NET whether to check the current value of the Auto Validate property. Passing False gives the same result that you get with no parameter at all and results in the Validating and Validated events being triggered.In such cases, you can force the controls in the support library to behave more closely to the original VB6 controls by setting the VB6Config.Focus Event Support static property to True: When this property is True, the support library ensures that the Lost Focus event is always fired after the Validate event.VB6 controls fire the Validate event first and then the Lost Focus event; if the Validate sets Cancel=True, then the Lost Focus event is never fired.The sequence is the same regardless of how the end user moves the input focus away from the control. NET controls fire these events in the same sequence only if end users move the input focus by means of the keyword; if they use the mouse, the control fires a Lost Focus event, then the Validating event, and – if the validation fails – another Got Focus event to let the application know that the focus is again on the control. NET programs created by VB Migration Partner follow the . In most cases, the fact that the Lost Focus event fires before the Validate event doesn’t affect the application negatively.
I'd recommend staying away from reflecting on the internal methods and properties of Framework classes.
thx and regard,s Norton Norton, I got the following tip from "Windows Forms Programming in C#" by Chris Sells, from Addison Wesley. How can something be wrong in a textbox when you use correct the validating event.
Within your "Accept" button click handler (the "save" button) process each control that Causes Validation to ensure that they are all valid... (Assuming you are not placing conflicting date in there by the program) It will be executed as that control looses the focus. Cor Phill, Now I understood you, in fact do you want to check if they are not empty?
Back Color = vb White End Sub Private Sub Text1_Validate(Cancel as Boolean) Cancel = (Text1. In some applications, however, the code in the Text1_Lost Focus method might depend on some variable that has been set in the Validate event.
Text = "") End Sub Now consider the corresponding VB. If the end user clicks on a different control and Text1 contains an empty string, the Lost Focus event resets the background color to white, then the Validate event cancels the focus shift, and finally the Got Focus event changes the background color to yellow again. If this is the case, the converted code might fail or behave unexpectedly.