MJ
Michal Jirku
April 3, 2004 11:17 AM UTC
Yoy can not create Handle and then call Close() method. Try to set "frm.MdiParent = Me" after show method, outside try & catch block.
>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
>
> Dim frm As New Form2
> Try
> frm.MdiParent = Me
> frm.Show()
> Catch ex As Exception
> MessageBox.Show(ex.Message)
> End Try
>
>--- 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
>
>
>
>
>
>