Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.myButton.Attributes.Add("onclick", "self.close()")
End Sub
ManicCW said:You can use javascript: self.close()
If you are closing it using an asp.net button then add attribute to button on page load event:
VB.NET:Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.myButton.Attributes.Add("onclick", "self.close()") End Sub
But I think that you wont be able to close the main form without alert box because of the security reasons.
[COLOR=darkgreen]'remove the empty spaces before and after "<>" if u want to use this func[/COLOR]
< script language="javascript" >
function closewindow() {
mywindow=window.close()
}
< /script >
< input type="button" value="Close the window" onclick="closewindow()" >