CurrencyManager cm;cm=(CurrencyManager) BindingContext[dataGrid1.DataSource];如要让第行选中(小三角移到该行),则如下表示:
cm.Position=4

解决方案 »

  1.   

    把dataGrid设置为只读属性,即使用户还可以在网格中用鼠标点击而选择某一格,但改不了其中的数据。
      

  2.   

    int i = 7;
    DataGrid1.SelectedIndex = i;
      

  3.   

    我帮你写一个datagrid事件:单击datagrid中某个单元格即选定该行
    private void yourDataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)

       System.Drawing.Point pt = new Point(e.X, e.Y);  
       DataGrid.HitTestInfo hit = this.yourDataGrid.HitTest(pt); 
       if(hit.Type == DataGrid.HitTestType.Cell)  
       { 
         this.yourDataGrid.CurrentCell = new DataGridCell(hit.Row, hit.Column); 
         this.yourDataGrid.Select(hit.Row); 
      }
    }
    顺便说一句,分这么重要么?给5分?