Me.Hide()

  • Thread starter Thread starter gene kelley
  • Start date Start date
G

gene kelley

I have a dialog form, frmDetails, that is opened from the main form:

frmDetails.ShowDialog()

The only way I have provided to close this dialog is via the "X" button.

If frmDetails is just closed as normal, there is no visual problem (no repainting) with the main
form.

Now, I add this code to the the FormClosing event in the dialog, frmDetails:

If e.CloseReason = CloseReason.UserClosing Then
e.Cancel = True
Me.Hide()

End If

In this case, the dialog hides, but in the process there is unacceptable amount of repainting on the
main form. A portion of the top right client area on the main form turns transparent for an instant
showing portions of any underlying app that may be present. I gather that this transparency
business is probably causing the repainting.

Does anyone know if the Hide method has a bug? Better method? Workaround?

Gene
 
Im new to vb.. but have you tried instead of doing the Me.Hide() to just try
to set the Opacity of the form to 0 first?

see if that work around solves ur display issue - then close the form?

-I have not had that happen to me at all with my Dialog forms. ( vb2003 )

Miro
 
Im new to vb.. but have you tried instead of doing the Me.Hide() to just try
to set the Opacity of the form to 0 first?

see if that work around solves ur display issue - then close the form?

-I have not had that happen to me at all with my Dialog forms. ( vb2003 )

Miro
The Opacity value of the dialog has no effect with regards to the problem. It's the actual call to
Hide versus Close that triggers the problem.

It now appears that the problem is being caused by a 3rd party control in use in this particular
app. If I temporarily remove it, the problem goes away, so I'm now checking with the control vendor
on this issue.

Gene
 
Back
Top