using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
namespace
mail
{
public
partial
class
Form1:Form
{
private
string
searchUrl
=
null
;
public
Form1()
{
InitializeComponent();
}
public
string
SearchUrl
{
get
{
return
searchUrl;
}
set
{
searchUrl
=
value;
}
}
private
void
Form1_Load(
object
sender,EventArgse)
{
Form2form2
=
new
Form2();
form2.Owner
=
this
;
form2.ShowDialog();
}
}
}
子窗口:
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace mail
{
public partial class Form2:Form
{
public Form2()
{
InitializeComponent();
}
private void setParent()
{
Form1f = (Form1) this .Owner;
f.SearchUrl = " www.baidu.com " ;
}
}
}