トップ回答者
コンパイル時に「エラー_3_error C3861: 'show': 識別子が見つかりませんでした_c:\users\user\documents\visual studio 2010\projects\otamesi\otamesi\Form1.h_123」とエラーが表示されてコンパイルできない

質問
-
VisualStudioC++2010ExpressでC言語に挑戦し始めたばかりの初心者ですが、windowsフォームアプリケーションをコンパイルする時に「errorC3861:'show':識別子が見つかりませんでした。」「errorC2039:'show':'System::windows::Forms::MessageBox'のメンバーではありません。」とエラーが出てコンパイル・ビルドが出来ません。どの様にしたらコンパイル出来るようになるか教えてください。
問題のソースは以下です。
#pragma once
namespace otamesi {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Form1 の概要
/// </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::Button^ 其の1;
protected:
private: System::Windows::Forms::RadioButton^ 其の2;
private: System::Windows::Forms::RadioButton^ 其の3;
private: System::Windows::Forms::WebBrowser^ 其の4;
private:
/// <summary>
/// 必要なデザイナー変数です。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
/// コード エディターで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
this->其の1 = (gcnew System::Windows::Forms::Button());
this->其の2 = (gcnew System::Windows::Forms::RadioButton());
this->其の3 = (gcnew System::Windows::Forms::RadioButton());
this->其の4 = (gcnew System::Windows::Forms::WebBrowser());
this->SuspendLayout();
//
// 其の1
//
this->其の1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 36, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(128)));
this->其の1->Location = System::Drawing::Point(12, 12);
this->其の1->Name = L"其の1";
this->其の1->Size = System::Drawing::Size(260, 58);
this->其の1->TabIndex = 0;
this->其の1->Text = L"其の1";
this->其の1->UseVisualStyleBackColor = true;
this->其の1->Click += gcnew System::EventHandler(this, &Form1::其の1_Click);
//
// 其の2
//
this->其の2->AutoSize = true;
this->其の2->Location = System::Drawing::Point(12, 98);
this->其の2->Name = L"其の2";
this->其の2->Size = System::Drawing::Size(53, 16);
this->其の2->TabIndex = 1;
this->其の2->TabStop = true;
this->其の2->Text = L"其の2";
this->其の2->UseVisualStyleBackColor = true;
//
// 其の3
//
this->其の3->AutoSize = true;
this->其の3->Location = System::Drawing::Point(219, 98);
this->其の3->Name = L"其の3";
this->其の3->Size = System::Drawing::Size(53, 16);
this->其の3->TabIndex = 2;
this->其の3->TabStop = true;
this->其の3->Text = L"其の3";
this->其の3->UseVisualStyleBackColor = true;
//
// 其の4
//
this->其の4->Location = System::Drawing::Point(12, 120);
this->其の4->MinimumSize = System::Drawing::Size(20, 20);
this->其の4->Name = L"其の4";
this->其の4->Size = System::Drawing::Size(260, 130);
this->其の4->TabIndex = 3;
this->其の4->Url = (gcnew System::Uri(L"http://www.yosirusu.jimdo.com", System::UriKind::Absolute));
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->Controls->Add(this->其の4);
this->Controls->Add(this->其の3);
this->Controls->Add(this->其の2);
this->Controls->Add(this->其の1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void 其の1_Click(System::Object^ sender, System::EventArgs^ e) {
//其の1
MessageBox::show("こんにちは!","其の1");
}
};
}
回答
-
すみません。検証は行ってないのですが、
MessageBox::show("こんにちは!","其の1");
の部分を
MessageBox::Show("こんにちは!","其の1");
としてみていかがでしょうか?「show」の「s」を大文字の「S」に
参考サイト: https://msdn.microsoft.com/ja-jp/library/system.windows.forms.messagebox(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1- 編集済み kenjinoteMVP 2016年5月22日 9:47
- 回答としてマーク yosirusu 2016年5月25日 11:54
すべての返信
-
すみません。検証は行ってないのですが、
MessageBox::show("こんにちは!","其の1");
の部分を
MessageBox::Show("こんにちは!","其の1");
としてみていかがでしょうか?「show」の「s」を大文字の「S」に
参考サイト: https://msdn.microsoft.com/ja-jp/library/system.windows.forms.messagebox(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1- 編集済み kenjinoteMVP 2016年5月22日 9:47
- 回答としてマーク yosirusu 2016年5月25日 11:54