How to hide Form by Esc then show form in .Net?

  • Thread starter Thread starter AU Gridlock
  • Start date Start date
A

AU Gridlock

Guest
Hi,

I created a form without a close button (x), when press esc then it will be hidden and after some event is triggered it will show again.

This's code to hide the form:

Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
If keyData = Keys.Escape Then
Me.Hide()
Return True
End If

Return MyBase.ProcessCmdKey(msg, keyData)
End Function


However, when the event triggered again: I got an error at line: myform.showdialog();


'Form showDialog tried to set an ineligible form as its owner. Forms cannot own themselves or their owners.

Also in the form_load event, I have put a procedure to fill a combobox data every time the form show comes back.

I don't know if that was the reason or because I pressed esc so the form canceled itself. How should I solve this problem?

Thanks a lot!

Continue reading...
 
Back
Top