会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
玄新-术业有专攻
ShowDialog 的子窗体回传数据到父窗体
以前做B
/
S ,现在改C
/
S 方法不是很一样
Form1 里面
加入
set
访问器
string
str_temp1;
public
string
str_test
{
set
{
str_temp1
=
value;
}
}
弹出Form2窗体
private
void
button1_Click(
object
sender, System.EventArgs e)
{
Form2 frm2
=
new
Form2();
frm2.Owner
=
this
;
frm2.ShowDialog();
this
.textBox1.Text
=
str_temp1;
}
Form2 窗体里面
private
void
button1_Click(
object
sender, System.EventArgs e)
{
if
(
this
.textBox1.Text
!=
""
)
{
Form1 pfrm
=
(Form1)
this
.Owner;
pfrm.str_test
=
this
.textBox1.Text;
this
.Close();
}
else
{
MessageBox.Show(
"
请输入!
"
);
}
}
没有办法,好长时间没有接触WinForm了,以前只是用Delphi 作过一些WinForm 的程序
posted on
2006-12-19 10:17
玄新
阅读(
249
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
导航
博客园
首页
联系
管理