2013-09-30 50 views
1

我知道這個問題之前已經(多次)被問,但我似乎無法找到答案。C++的CodeDOM分析器錯誤:行:75,列:57 ---內部錯誤

我已經將一個TestBox拖放到表單上,該表單爲我生成了 void InitializeComponent(void)方法中的代碼。當我加入然而這一行:

this->MyTextBox->Text = DateTime::Now.ToString();

它在標題的錯誤,當我打開設計上來? 我的問題是,爲什麼會發生這種情況;以及如何擺脫它。

這是整個頁面的內容代碼:任何建議

#pragma once 

namespace Project1 { 



    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> 
    /// Summary for MyForm 
    /// </summary> 
    public ref class MyForm : public System::Windows::Forms::Form 
    { 
    public: 
     MyForm(void) 
     { 
      InitializeComponent(); 
      // 
      //TODO: Add the constructor code here 
      // 
     } 

    protected: 
     /// <summary> 
     /// Clean up any resources being used. 
     /// </summary> 
     ~MyForm() 
     { 
      if (components) 
      { 
       delete components; 
      } 
     } 
    private: System::Windows::Forms::Label^ label1; 
    private: System::Windows::Forms::TextBox^ MyTextBox; 
    protected: 

    protected: 

    private: 
     /// <summary> 
     /// Required designer variable. 
     /// </summary> 
     System::ComponentModel::Container ^components; 

    #pragma region Windows Form Designer generated code 

     //MAIN METHOD FOR FORM 

     void InitializeComponent(void) 
     { 
      this->label1 = (gcnew System::Windows::Forms::Label()); 
      this->MyTextBox = (gcnew System::Windows::Forms::TextBox()); 
      this->SuspendLayout(); 
      // 
      // label1 
      // 
      this->label1->AutoSize = true; 
      this->label1->Location = System::Drawing::Point(132, 123); 
      this->label1->Name = L"label1"; 
      this->label1->Size = System::Drawing::Size(75, 13); 
      this->label1->TabIndex = 0; 
      this->label1->Text = L"Callum Holden"; 
      this->label1->Click += gcnew System::EventHandler(this, &MyForm::label1_Click); 
      // 
      // MyTextBox 
      // 
      this->MyTextBox->Location = System::Drawing::Point(54, 183); 
      this->MyTextBox->Name = L"MyTextBox"; 
      this->MyTextBox->Size = System::Drawing::Size(100, 20); 
      this->MyTextBox->TabIndex = 1; 
      this->MyTextBox->Text = L"g" + DateTime::Now.ToString(); 



      // 
      // MyForm 
      // 
      this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); 
      this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; 
      this->ClientSize = System::Drawing::Size(308, 275); 
      this->Controls->Add(this->MyTextBox); 
      this->Controls->Add(this->label1); 
      this->Name = L"MyForm"; 
      this->Text = L"MyForm"; 
      this->ResumeLayout(false); 
      this->PerformLayout(); 

     } 


#pragma endregion 

    private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { 

      } 
    }; 
} 

三江源!

卡勒姆

回答

0

試試這個:(發現here

this->MyTextBox->Text = DateTime::Now->ToString();