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 編輯過 |
關鍵字查詢
相關文章
正在查詢... |