Visual C ++获取TextBox的路径和文件名

时间:2013-06-22 10:42:25

标签: winforms visual-studio-2010 visual-c++

我希望显示完整路径+名称+图像文件的扩展名到Visual C ++ TextBox(Windows窗体),当我尝试构建它时,它失败了:

1>------ Build started: Project: Testing, Configuration: Debug Win32 ------
1>  Testing.cpp
1>Testing.obj : error LNK2020: unresolved token (06000003) Testing.Form1::GetFileName
1>c:\users\febri nur hidayat\documents\visual studio 2010\Projects\Testing\Debug\Testing.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


这是我的源代码:

private: System::Void textBox1_Click(System::Object^  sender, System::EventArgs^  e) {
    if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK){
        this->pictureBox1->Image = Image::FromFile(openFileDialog1->FileName);
        String^ sourceImage;
        citra = Path::GetFileName(openFileDialog1->FileName);
        this->textBox1->Text = sourceImage;
    }
}


任何建议或我应该编码什么?

0 个答案:

没有答案