2013-09-30 32 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();