XP 詳しくわからないのですがVC++?
テキストボックスに書かれている内容を書き出したいのですが
どのようにすればよいのでしょうか?
現在コメント(※1)になっているところに処理を入れようとしておりま。
困っているのはテキストボックスの情報をどうやって取ってくるかということです、
※1 //write->WriteLine(this->textBox1->
どうかよろしくお願いします。
ファイルの書き出し VC++
#pragma once
namespace Memo {
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>
/// Form1 の概要
///
/// 警告: このクラスの名前を変更する場合、このクラスが依存するすべての .resx ファイルに関連付けられた
/// マネージ リソース コンパイラ ツールに対して 'Resource File Name' プロパティを
/// 変更する必要があります。この変更を行わないと、
/// デザイナと、このフォームに関連付けられたローカライズ済みリソースとが、
/// 正しく相互に利用できなくなります。
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: ここにコンストラクタ コードを追加します
//
}
protected:
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TabControl^ tabControl1;
protected:
private: System::Windows::Forms::TabPage^ tabPage1;
private: System::Windows::Forms::TabPage^ tabPage2;
private: System::Windows::Forms::TabPage^ tabPage3;
private: System::Windows::Forms::TabPage^ tabPage4;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ menuFile;
private: System::Windows::Forms::ToolStripMenuItem^ menuOpen;
private: System::Windows::Forms::ToolStripMenuItem^ menuAsSave;
private:
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(1, 6);
this->textBox1->Multiline = true;
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(628, 414);
this->textBox1->TabIndex = 0;
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->menuFile});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(640, 24);
this->menuStrip1->TabIndex = 1;
this->menuStrip1->Text = L"menuStrip1";
//
// menuFile
//
this->menuFile->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->menuOpen, this->menuAsSave});
this->menuFile->Name = L"menuFile";
this->menuFile->Size = System::Drawing::Size(51, 20);
this->menuFile->Text = L"ファイル";
//////////略
//
// menuOpen
//
this->menuOpen->Name = L"menuOpen";
this->menuOpen->Size = System::Drawing::Size(152, 22);
this->menuOpen->Text = L"開く";
//
// menuAsSave
//
this->menuAsSave->Name = L"menuAsSave";
this->menuAsSave->Size = System::Drawing::Size(152, 22);
this->menuAsSave->Text = L"上書き保存";
this->menuAsSave->Click += gcnew System::EventHandler(this, &Form1::menuAsSave_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(640, 480);
this->Controls->Add(this->tabControl1);
this->Controls->Add(this->menuStrip1);
this->MainMenuStrip = this->menuStrip1;
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->tabControl1->ResumeLayout(false);
this->tabPage1->ResumeLayout(false);
this->tabPage1->PerformLayout();
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void menuAsSave_Click(System::Object^ sender, System::EventArgs^ e) {
StreamWriter^ write = gcnew StreamWriter("text_01.txt");
//write->WriteLine("aaa");
//write->WriteLine(this->textBox1->
write->Close();
MessageBox::Show("ファイルに書き込みました");
}
};
}