当前位置: 代码迷 >> VC >> Form2.h[设计]界面编辑上出现下面的提示什么原因呢?多谢
  详细解决方案

Form2.h[设计]界面编辑上出现下面的提示什么原因呢?多谢

热度:501   发布时间:2016-05-05 00:08:52.0
Form2.h[设计]界面编辑上出现下面的提示什么原因呢?谢谢
本帖最后由 VisualEleven 于 2014-01-13 11:27:24 编辑

我是在添加了下面的代码后,然后再返回界面去出现这种情况的,谢谢
void InitializeComponent(void)
{
this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^  >(2) {this->Column1, 
this->Column2});
this->dataGridView1->Location = System::Drawing::Point(13, 163);
this->dataGridView1->Name = L"dataGridView1";
this->dataGridView1->RowTemplate->Height = 23;
this->dataGridView1->Size = System::Drawing::Size(296, 150);
this->dataGridView1->TabIndex = 5;

   //上面是自带的,加上下面的就出错了,但是运行还是可以的,指再没法编辑了,谢谢
     this->dataGridView1->Rows[0]->Cells[0]->Value = "1";  
     this->dataGridView1->Rows[0]->Cells[1]->Value = "2";  
     this->dataGridView1->Rows[0]->Cells[2]->Value = "3";
}

------解决方案--------------------
貌似一共只有两列吧?Cell[2]越界?
------解决方案--------------------
这是用非托管代码写的吗,不懂,绑定吧
  相关解决方案