C# 父子窗体之间互相传值_调用子窗体方法_(菜鸟级别)
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
C# 窗体间传值_调用子窗体方法_(菜鸟级别),定义一个子窗体属性,将ChildFrm属性赋值为frm,菜鸟级别的代码,至少懂一点面向对象思想。
父窗口(FormSetup):
public static FtpConnect FtpConnectForm = null; //定义一个子窗体属性
private void btnSelRemoteFtpPath_Click(object sender, EventArgs e)
{
if (FtpConnectForm == null)
{
FtpConnect form = new FtpConnect(this);
form.Show();
}
else
{
FtpConnectForm.Close();
FtpConnectForm = null;
}
} 子窗口(FtpConnect):
public static FormSetup FormSetupForm = null;
public FtpConnect(FormSetup TempForm)
{
InitializeComponent();
FormSetup.FtpConnectForm = this;
FormSetupForm = TempForm;
}
private void treeView_path_list_AfterSelect(object sender, TreeViewEventArgs e)
{
string selectedNodeName = treeView_path_list.SelectedNode.Tag.ToString();
txtRemoteFTPPath.Text = selectedNodeName;
FormSetupForm.txtRemoteFTPPath.Text = selectedNodeName;
} 该文章在 2021/7/12 15:12:55 编辑过 |
关键字查询
相关文章
正在查询... |