I'm building a form using Microsoft Visual Studio 2010 32-bit Premium (Microsoft Visual Basic 2010). When I compile the code there aren't any errors, but whenever I click on the exit button it gives me this message:
Win32Exception was unhandled" "error creating window handle".
What is the reason for this error and how can it be fixed?
I did this code in the university's lab, and it worked fine. But when I run it at home, I'm getting this error.
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
If MsgBox("Are you sure you want to exit the program?", MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo) Then
End ' error creating window handle
End If
End Sub
I'm using Windows 8 64-bit and Microsoft Visual Studio 2010 32-bit Premium.
Endto exit a program. It'sApplication.ExitorMe.Close! - OneFineDayEndwould produce such a mysterious exception is far more interesting. It is a perfectly valid way to end a program. Just like Environment.Exit(), also doesn't work anymore. Too bad nobody is interested. - Hans PassantEndhas been explained to me as bad like on the evil side of bad. It closes the application without closing all message pumps properly. It does not allow for any calling code to clean up cleanly. It might work fine in some places, but hurt you in others. I was told it's just bad practice. - OneFineDay