Visual c++ visualc&x2B+;-类型为';System.IO.IOException';在mscorlib.dll(Windows 8)中发生 我是意大利人,我不得不注册,告诉你我使用VisualC++(Windows表单应用程序)的问
visualc&x2B+;-类型为';System.IO.IOException';在mscorlib.dll(Windows 8)中发生 <>我是意大利人,我不得不注册,告诉你我使用VisualC++(Windows表单应用程序)的问题。Visual c++ visualc&x2B+;-类型为';System.IO.IOException';在mscorlib.dll(Windows 8)中发生 我是意大利人,我不得不注册,告诉你我使用VisualC++(Windows表单应用程序)的问,visual-c++,Visual C++,visualc&x2B+;-类型为';System.IO.IOException';在mscorlib.dll(Windows 8)中发生 我是意大利人,我不得不注册,告诉你我使用VisualC++(Windows表单应用程序)的问题。 #pragma一次 名称空间测试{ 使用名称空间系统; 使用名称空间System::ComponentModel; 使用名称空间系统::集合; 使用命名空间System::Windows::Forms; 使用名称空间System::Dat
#pragma一次
名称空间测试{
使用名称空间系统;
使用名称空间System::ComponentModel;
使用名称空间系统::集合;
使用命名空间System::Windows::Forms;
使用名称空间System::Data;
使用名称空间系统::绘图;
使用名称空间系统::IO;
///
///表格1摘要
///
public ref类Form1:public System::Windows::Forms::Form
{
公众:
表格1(无效)
{
初始化组件();
//
//TODO:在此处添加构造函数代码
//
}
受保护的:
///
///清理所有正在使用的资源。
///
~Form1()
{
if(组件)
{
删除组件;
}
}
私有:系统::Windows::窗体::按钮^button1;
受保护的:
私有:系统::Windows::窗体::按钮^button2;
private:System::Windows::Forms::TextBox^textBox1;
private:System::Windows::Forms::TextBox^textBox2;
私有:系统::Windows::窗体::按钮^button3;
私有:系统::Windows::窗体::FolderBrowserDialog^folderBrowserDialog1;
受保护的:
私人:
///
///必需的设计器变量。
///
系统::组件模型::容器^组件;
#pragma区域Windows窗体设计器生成的代码
///
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
///
void初始化组件(void)
{
此->按钮1=(gcnew System::Windows::Forms::Button());
此->按钮2=(gcnew System::Windows::Forms::Button());
这->textBox1=(gcnewsystem::Windows::Forms::TextBox());
这->textBox2=(gcnewsystem::Windows::Forms::TextBox());
此->按钮3=(gcnew System::Windows::Forms::Button());
这->folderBrowserDialog1=(gcnew System::Windows::Forms::FolderBrowserDialog());
此->SuspendLayout();
//
//按钮1
//
此->按钮1->位置=系统::图纸::点(316,9);
此->按钮1->名称=L“按钮1”;
该->按钮1->尺寸=系统::图纸::尺寸(75,23);
此->按钮1->选项卡索引=0;
此->按钮1->文本=L“按钮1”;
此->按钮1->UseVisualStyleBackColor=true;
此->按钮1->Click+=gcnewsystem::EventHandler(此,&Form1::按钮1\u Click);
//
//按钮2
//
此->按钮2->位置=系统::图纸::点(316,53);
此->按钮2->名称=L“按钮2”;
该->按钮2->尺寸=系统::图纸::尺寸(75,23);
此->按钮2->选项卡索引=1;
此->按钮2->文本=L“按钮2”;
此->按钮2->UseVisualStyleBackColor=true;
此->按钮2->单击+=gcnew System::EventHandler(此,&Form1::按钮2\u单击);
//
//文本框1
//
此->文本框1->位置=系统::图纸::点(28,9);
此->文本框1->多行=true;
此->textBox1->Name=L“textBox1”;
这->文本框1->尺寸=系统::图纸::尺寸(278,23);
此->文本框1->TabIndex=2;
//
//文本框2
//
此->文本框2->位置=系统::图纸::点(28,53);
此->文本框2->多行=true;
此->textBox2->Name=L“textBox2”;
这->文本框2->尺寸=系统::图纸::尺寸(278,23);
此->文本框2->选项卡索引=3;
//
//按钮3
//
此->按钮3->位置=系统::图纸::点(133102);
此->按钮3->名称=L“按钮3”;
此->按钮3->尺寸=系统::图纸::尺寸(75,23);
此->按钮3->选项卡索引=4;
此->按钮3->文本=L“按钮3”;
此->按钮3->UseVisualStyleBackColor=true;
此->按钮3->单击+=gcnew System::EventHandler(此,&Form1::按钮3\u单击);
//
//FolderBrowser对话框1
//
this->folderBrowserDialog1->HelpRequest+=gcnew System::EventHandler(this,&Form1::folderBrowserDialog1\u HelpRequest);
//
//表格1
//
这->自动缩放尺寸=系统::图纸::尺寸(6,13);
这->AutoScaleMode=System::Windows::Forms::AutoScaleMode::Font;
这->ClientSize=System::Drawing::Size(453170);
此->控制->添加(此->按钮3);
此->控制->添加(此->文本框2);
此->控制->添加(此->文本框1);
此->控制->添加(此->按钮2);
此->控制->添加(此->按钮1);
此->名称=L“Form1”;
此->文本=L“Form1”;
此->恢复布局(错误);
此->执行布局();
}
#布拉格端区
私有:系统::无效按钮1\u单击(系统::对象^sender,系统::事件参数^e){
OpenFileDialog^选择directory=gcnew OpenFileDialog;
选择目录->显示对话框();
textBox1->Text=选择目录->文件名;
}
私有:系统::无效按钮2\u单击(系统::对象^sender,系统::事件参数^e){
FolderBrowserDialog ^fbd=gcnew FolderBrowserDialog;
fbd->ShowDialog();
textBox2->Text=fbd->SelectedPath;
}
私有:系统::无效按钮3_单击(系统::对象^sender,系统::事件参数^e){
文件::移动(textBox1->Text,textBox2->Text);
MessageBox::Show
#pragma once
namespace test {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::FolderBrowserDialog^ folderBrowserDialog1;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->button3 = (gcnew System::Windows::Forms::Button());
this->folderBrowserDialog1 = (gcnew System::Windows::Forms::FolderBrowserDialog());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(316, 9);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(316, 53);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 23);
this->button2->TabIndex = 1;
this->button2->Text = L"button2";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(28, 9);
this->textBox1->Multiline = true;
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(278, 23);
this->textBox1->TabIndex = 2;
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(28, 53);
this->textBox2->Multiline = true;
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(278, 23);
this->textBox2->TabIndex = 3;
//
// button3
//
this->button3->Location = System::Drawing::Point(133, 102);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(75, 23);
this->button3->TabIndex = 4;
this->button3->Text = L"button3";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// folderBrowserDialog1
//
this->folderBrowserDialog1->HelpRequest += gcnew System::EventHandler(this, &Form1::folderBrowserDialog1_HelpRequest);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(453, 170);
this->Controls->Add(this->button3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
OpenFileDialog^ chooseDirectory = gcnew OpenFileDialog;
chooseDirectory->ShowDialog();
textBox1->Text = chooseDirectory->FileName;
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
FolderBrowserDialog^ fbd = gcnew FolderBrowserDialog;
fbd->ShowDialog();
textBox2->Text = fbd->SelectedPath;
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
File::Move(textBox1->Text, textBox2->Text);
MessageBox::Show("Success","File's directory has been changed!", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
private: System::Void folderBrowserDialog1_HelpRequest(System::Object^ sender, System::EventArgs^ e) {
}
};
}