我正在尝试将textBox1
值从Form5
传递给Form1
。但是,当它到达Form1
时似乎没有记住或看到它的值。我希望paf_path
成为paf_path2
。
System::Void Form5::button1_Click(System::Object^ sender, System::EventArgs^ e) {
System::String^ paf_path2 = textBox1->Text;
FolderBrowserDialog^ folderBrowserDialog1;
folderBrowserDialog1 = gcnew System::Windows::Forms::FolderBrowserDialog;
folderBrowserDialog1->Description = L"Select the directory of your MAF files ";
folderBrowserDialog1->ShowNewFolderButton = false;
// Show the FolderBrowserDialog.
System::Windows::Forms::DialogResult result = folderBrowserDialog1->ShowDialog();
if (result == ::DialogResult::OK)
{
paf_path2 = folderBrowserDialog1->SelectedPath;
}
textBox1->Text = paf_path2;
}
System::Void Form5::button2_Click(System::Object^ sender, System::EventArgs^ e){
Form1 ^dos3 = gcnew Form1(this);
dos3->Show();
this->Hide();
}
System::Void Form1::button1_Click(System::Object^ sender, System::EventArgs^ e) {
System::String^ test = textBox1->Text;
if (test == "")
{
MessageBox::Show("Please enter partial address!");
}
else
{
Form5^doss = gcnew Form5(this);
System::String^ paf_path2 = doss->textBox1->Text;
char* paf_path = (char*) (void*) Marshal::StringToHGlobalAnsi(paf_path2);