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:
'Parent Form Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click RegisterStartupScript("ClientSideScript", "<script language=javascript>window.open('OpenFile.aspx', null, 'location=no;status=no;addressbar=no;toolbar=no,height=350,width=250')</script>") End Sub Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try TextBox1.Text = Session("name").ToString() Catch oEX As Exception Console.WriteLine(oEX.ToString) End Try End SubVB Code:
'Child Form Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sfile As String = Dir("C:\Temp\*.xml", FileAttribute.Normal) While sfile <> Nothing sfile = sfile.Substring(0, sfile.IndexOf("_"c)) & ", " & sfile.Substring(sfile.IndexOf("_"c) + 1) sfile = sfile.Substring(0, sfile.Length - 4).ToUpper ListBox1.Items.Add(sfile) sfile = Dir() End While End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Session("name") = ListBox1.SelectedValue Server.Transfer("webform1.aspx") RegisterStartupScript("ClientSideScript", "<script language=javascript>window.close();</script>") 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.


Reply With Quote