譬如说这段代码,已经含有一个datagridview了,可是他不响应的~~
To run this example, paste the code into a form that contains a DataGridView named dataGridView1 and ensure that all events are associated with their event handlers.
--------------------------------------------------
private void dataGridView1_CellEnter(object sender, 
    DataGridViewCellEventArgs e)
{
    dataGridView1[e.ColumnIndex, e.RowIndex].Style
        .SelectionBackColor = Color.Blue;
}private void dataGridView1_CellLeave(object sender, 
    DataGridViewCellEventArgs e)
{
    dataGridView1[e.ColumnIndex, e.RowIndex].Style
        .SelectionBackColor = Color.Empty;
}

解决方案 »

  1.   

    ensure that all events are associated with their event handlers---------这个出问题了? 如何ensure? 他也没报错啊~~
      

  2.   

    方法InitializeComponent中,有类似的
    this.Load += new System.EventHandler(this.NNAG01_Load);
    事件关联吗?仅仅拷贝是不行的,必须建立事件关联才可以。
      

  3.   

    dataGridView1_CellLeave  ,找到 datagridview1 ,然后查看事件属性,指定它的dataGridView1_CellLeave,或则直接在load 写  dataGridView1.oncellleave+=dataGridView1_CellLeave,总的来说就是要关联一下
      

  4.   

    在ide界面中找到datagridview 在它的事件中找到对应事件 并选择你已经添加好的方法