DataGrid.CurrentRowIndex 속성

정의

현재 포커스가 있는 행의 인덱스를 가져오거나 설정합니다.

public:
 property int CurrentRowIndex { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int CurrentRowIndex { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.CurrentRowIndex : int with get, set
Public Property CurrentRowIndex As Integer

속성 값

Int32

현재 행의 인덱스(0부터 시작)입니다.

특성

예외

CurrencyManager가 없는 경우

예제

다음 코드 예제 CurrentRowIndex에서는 .

private:
   void GetSelectedIndex( DataGrid^ myGrid )
   {
      Console::WriteLine( myGrid->CurrentRowIndex );
   }

   void SetSelectedIndex( DataGrid^ myGrid, int selIndex )
   {
      myGrid->CurrentRowIndex = selIndex;
   }
private void GetSelectedIndex(DataGrid myGrid){
    Console.WriteLine(myGrid.CurrentRowIndex);
 }
 
 private void SetSelectedIndex(DataGrid myGrid, int selIndex){
    myGrid.CurrentRowIndex = selIndex;
 }
Private Sub GetSelectedIndex(ByVal myGrid As DataGrid)
    Console.WriteLine(myGrid.CurrentRowIndex)
 End Sub
 
 Private Sub SetSelectedIndex(ByVal myGrid As DataGrid, ByVal selIndex As Integer)
    myGrid.CurrentRowIndex= selIndex
 End Sub

설명

CurrentRowIndex 속성을 현재 값이 아닌 값으로 설정하면 지정된 행이 보기에 있도록 컨트롤이 스크롤됩니다.

CurrentRowIndex 속성을 사용하면 자식 테이블 행을 보는 경우에도 부모 테이블의 행을 반복할 수 있습니다. 예를 들어 자식 테이블을 보는 경우 증분 CurrentRowIndex System.Windows.Forms.DataGrid 하면 부모 테이블에 연결된 자식 테이블에 다음 레코드 집합이 표시됩니다.

사용자가 부모 테이블이나 자식 관계가 없는 테이블을 보는 경우 이 속성은 현재 행의 인덱스(0부터 시작하는 인덱스)를 반환합니다.

적용 대상

추가 정보