*****A、B 兩個form,A打開B 後,B確定關閉後,B參數傳給A*****
A打開B
private void btnSelectT_Click(object sender, EventArgs e)
{
FrmFtpConfigure frmFtpConfigure = new FrmFtpConfigure();
if (frmFtpConfigure.ShowDialog(this) == DialogResult.OK)
{
ftpUserID = frmFtpConfigure.ftpUserID;
ftpPassword = frmFtpConfigure.ftpPassword;
ftpURI = frmFtpConfigure.ftpURI;
}
}
B關閉
private void btnSave_Click(object sender, EventArgs e)
{
this.ftpServerIP = this.textBox1.Text;
this.ftpUserID = this.textBox2.Text;
this.ftpPassword = this.textBox3.Text;
this.ftpPort = this.textBox4.Text;
this.ftpRemotePath = this.textBox5.Text;
if (ftpPort != "21")
ftpServerIP = ftpServerIP + ":" + ftpPort;
ftpURI = "ftp://" + ftpServerIP + "/" + ftpRemotePath + "/";
this.DialogResult = DialogResult.OK;
this.Close();
}
之後,A就可以看到B傳過來的參數了。