C# 父子窗體之間互相傳值_調(diào)用子窗體方法_(菜鳥(niǎo)級(jí)別)
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
C# 窗體間傳值_調(diào)用子窗體方法_(菜鳥(niǎo)級(jí)別),定義一個(gè)子窗體屬性,將ChildFrm屬性賦值為frm,菜鳥(niǎo)級(jí)別的代碼,至少懂一點(diǎn)面向?qū)ο笏枷搿?/span>
父窗口(FormSetup):
public static FtpConnect FtpConnectForm = null; //定義一個(gè)子窗體屬性
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 編輯過(guò) |
關(guān)鍵字查詢(xún)
相關(guān)文章
正在查詢(xún)... |