הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Tuesday, July 7, 2009 2:39 PM
For now i have not finished my code and as i am still really playing with .net to learn the different functions how can i close the windows application down after the ok only message box has been clicked?
here is the code so far:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click
MsgBox("Close on Ok", MsgBoxStyle.OkOnly, "Not Finished")
cmdGo_Click.close(Form1)
End Sub
Thank you
Andy
the cmdGo_Click.close(form1) has a mouse pointer tag saying "Arguement not specified for parameter 'e' of 'Private Sub cmdGo_Click(sender As Object, e As System.EventArgs)'"
All replies (2)
Tuesday, July 7, 2009 3:17 PM ✅Answered | 1 vote
For now i have not finished my code and as i am still really playing with .net to learn the different functions how can i close the windows application down after the ok only message box has been clicked?
here is the code so far:
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click MsgBox("Close on Ok", MsgBoxStyle.OkOnly, "Not Finished") cmdGo_Click.close(Form1) End Sub
Thank you
Andy
the cmdGo_Click.close(form1) has a mouse pointer tag saying "Arguement not specified for parameter 'e' of 'Private Sub cmdGo_Click(sender As Object, e As System.EventArgs)'"
In that code, you were trying to call a non-existent close method of the button to close the form. The mouse pointer tag is called a tool tip, or at least it used to be called that.
Next, you are calling close, but...which one, and on what? Since your application is evidently exiting, It must be calling Close on the Form. If that is your intent, it might be a good idea to make that clear by using Form1.Close(), whichever is more appropriate.
I would use the more appropriate Application.Exit() because it uses the message system and gives your code a chance to finish up before exiting in a standard way. The code currently only close the form, which does not necessarily end an application, or clean up properly. Prior to .NET 2.0, Application.Exit() did not call Form.Close() and that must be done manually.
Tuesday, July 7, 2009 2:43 PM
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click
MsgBox("Close on Ok", MsgBoxStyle.OkOnly, "Not Finished")
close()
End Sub
edited the code so it looks like this and it works now.