Winforms visualc&x2B+;获取文本框的路径和文件名
我想在VisualC++文本框(Windows窗体)中显示完整路径+名称+图像文件的扩展,当我尝试构建时,它失败了:Winforms visualc&x2B+;获取文本框的路径和文件名,winforms,visual-studio-2010,visual-c++,Winforms,Visual Studio 2010,Visual C++,我想在VisualC++文本框(Windows窗体)中显示完整路径+名称+图像文件的扩展,当我尝试构建时,它失败了:BR> 1>------ Build started: Project: Testing, Configuration: Debug Win32 ------ 1> Testing.cpp 1>Testing.obj : error LNK2020: unresolved token (06000003) Testing.Form1::GetFileName 1
BR>
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;
}
}
有什么建议或我应该编写什么代码吗?无需调用
GetFileName
。只需执行以下操作:this->textBox1->Text=openFileDialog1->FileName
仍不工作,致命错误LNK1120:1未解析外部:(