Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2003, 10:48 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to gvozden
Default Close in the load event on child form

This sample fire exception "Cannot call Close() while doing CreateHandle()."

1. What is the cause of this error?
2. Is there any solution and if yes, what it would be?


'------ in main form

 Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        Dim frm As New Form2
        Try
            frm.MdiParent = Me
            frm.Show()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

'------- in child form


  Dim bUslov As Boolean

    Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

        '---- code

        bUslov = True

        ' ----- code

        If bUslov Then
            Me.Close()
        End If

    End Sub









Similar Threads
Thread Thread Starter Forum Replies Last Post
Close Child window automatically on closing parent vikas67k C# 1 August 26th, 2008 02:00 AM
Interrupting DoCmd.Close & Form Unload Event SerranoG Access 2 November 19th, 2005 03:41 PM
Overriding Form Close event Chris Beach C# 1 January 16th, 2005 10:20 AM
Child Page Problem with Handles My.Base Load bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 1 October 4th, 2004 09:30 AM
Make child close automatically after 3 seconds sherbir Javascript 2 August 25th, 2004 11:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.