Window.Close Problem

pricejt

New member
Joined
May 8, 2007
Messages
3
Programming Experience
3-5
I have an application in vb and need vb to close my internet explorer window after it makes a call to the server. Having a slight bug in it. It seems to work just fine when the window is in a modeless state. but when we try to close the window with javascript from the server in a modal state the window tries to open up another window in modeless state and then close it. never closing the model window. Not sure whats going on here but here is my code. I have tried it two different ways.

VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] btnConfirm_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] btnConfirm.Click
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sSessionKey [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = Request.QueryString("SessionKey")
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sSelectedCustomerID [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2].Empty
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] sSelectedCustomerName [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2].Empty
sSelectedCustomerID = Session("ShipToCustId")
sSelectedCustomerName = Session("ShipToCustName")
HttpContext.Current.Session("CustomerID" & sSessionKey) = sSelectedCustomerID
HttpContext.Current.Session("CustomerName" & sSessionKey) = sSelectedCustomerName
[/SIZE][SIZE=2][COLOR=#008000]'Me.Page.RegisterClientScriptBlock("CloseScript", "<script language='javascript'>window.close();</script>")
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Page.RegisterStartupScript("AttachScript", "<script language='javascript'>window.attachEvent('onload', function () {window.close();})</script>")
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE]

any help would be greatly appriciated
 
Back
Top