I am using VS .Net 2003 and VB. I have an app with one parent and two
Mdi child forms. I need to validate data in the Mdi form. The
Form.Validating event works when I try to close a Mdi form, but not
when I try to switch form one Mdi form to the other. I tried to add
code to MdiForm1's Deactivate event:
Private Sub MidForm1_Deacti vate(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Deactiva te
Dim TempE As System.Componen tModel.CancelEv entArgs
TempE.Cancel = False
MdiForm1_Valida ting(sender, TempE)
If TempE.Cancel Then
MdiForm1_Activa ted(sender, e)
End If
End Sub
but when MdiForm2 tries to load, the program crashes:
An unhandled exception of type 'System.OutOfMe moryException' occurred
in system.windows. forms.dll
Additional information: Error creating window handle.
How can I keep the focus in MdiForm1 when the user wants to change
forms and the data in MdiForm1 is not valid?
Thanks
Eric
Mdi child forms. I need to validate data in the Mdi form. The
Form.Validating event works when I try to close a Mdi form, but not
when I try to switch form one Mdi form to the other. I tried to add
code to MdiForm1's Deactivate event:
Private Sub MidForm1_Deacti vate(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Deactiva te
Dim TempE As System.Componen tModel.CancelEv entArgs
TempE.Cancel = False
MdiForm1_Valida ting(sender, TempE)
If TempE.Cancel Then
MdiForm1_Activa ted(sender, e)
End If
End Sub
but when MdiForm2 tries to load, the program crashes:
An unhandled exception of type 'System.OutOfMe moryException' occurred
in system.windows. forms.dll
Additional information: Error creating window handle.
How can I keep the focus in MdiForm1 when the user wants to change
forms and the data in MdiForm1 is not valid?
Thanks
Eric
Comment