谢谢。

解决方案 »

  1.   

    是做web还是做win呀,有很多现成例子的
      

  2.   

    //next one
    if(dataGrid1.DataSource!=null)
    {
    dataGrid1.UnSelect(dataGrid1.CurrentRowIndex);
    dataGrid1.CurrentRowIndex=dataGrid1.CurrentRowIndex+1;
    //dataGrid1.Select(dataGrid1.CurrentRowIndex);
    }
    //last one
    if(dataGrid1.DataSource!=null)
    {
    dataGrid1.UnSelect(dataGrid1.CurrentRowIndex);
    dataGrid1.CurrentRowIndex=dataGrid1.CurrentRowIndex-1;
    }
    //first 
    if(dataGrid1.DataSource!=null)
    {
    dataGrid1.UnSelect(dataGrid1.CurrentRowIndex);
    dataGrid1.CurrentRowIndex=0;
    }
    //last
    if(dataGrid1.DataSource!=null)
    {
    dataGrid1.UnSelect(dataGrid1.CurrentRowIndex);
    int count=dataSet1.Tables[opentable].Rows.Count;
    dataGrid1.CurrentRowIndex=count-1;
    }
    以上代码都是相应事件处理函数中