I've got two forms. The parent opens a kind of open file dialog box in the form of a web page. The child form consists of a listbox which gets populated with filenames, and a command button. I would like to pass the selected value back to the parent form. This is what I have so far:
VB Code:
  1. 'Parent Form
  2.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.         RegisterStartupScript("ClientSideScript", "<script language=javascript>window.open('OpenFile.aspx', null, 'location=no;status=no;addressbar=no;toolbar=no,height=350,width=250')</script>")
  4.     End Sub
  5.  
  6.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.         Try
  8.             TextBox1.Text = Session("name").ToString()
  9.         Catch oEX As Exception
  10.             Console.WriteLine(oEX.ToString)
  11.         End Try
  12.     End Sub
VB Code:
  1. 'Child Form
  2.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  3.         Dim sfile As String = Dir("C:\Temp\*.xml", FileAttribute.Normal)
  4.         While sfile <> Nothing
  5.             sfile = sfile.Substring(0, sfile.IndexOf("_"c)) & ", " & sfile.Substring(sfile.IndexOf("_"c) + 1)
  6.             sfile = sfile.Substring(0, sfile.Length - 4).ToUpper
  7.             ListBox1.Items.Add(sfile)
  8.             sfile = Dir()
  9.         End While
  10.  
  11.     End Sub
  12.  
  13.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  14.         Session("name") = ListBox1.SelectedValue
  15.         Server.Transfer("webform1.aspx")
  16.         RegisterStartupScript("ClientSideScript", "<script language=javascript>window.close();</script>")
  17.  
  18.     End Sub

The problem is, the parent form reopens in the child form's browser after I pass the variable. I would really like the child form to close, and have the original parent form handle the variable.