DataRow.HasVersion(DataRowVersion) 메서드

정의

지정된 버전이 있는지 여부를 나타내는 값을 가져옵니다.

public:
 bool HasVersion(System::Data::DataRowVersion version);
public bool HasVersion(System.Data.DataRowVersion version);
member this.HasVersion : System.Data.DataRowVersion -> bool
Public Function HasVersion (version As DataRowVersion) As Boolean

매개 변수

version
DataRowVersion

행 버전을 지정하는 값 중 DataRowVersion 하나입니다.

반품

true버전이 있으면 이고, 그렇지 않으면 . false

예제

다음 예제에서는 메서드를 HasVersion 사용하여 열의 현재 값과 제안된 값이 같은지 여부를 확인합니다. 이 경우 편집이 취소됩니다. 그렇지 않으면 편집을 AcceptChanges 종료하기 위해 메서드가 호출됩니다.

Private Sub CheckVersionBeforeAccept()
    ' Assuming the DataGrid is bound to a DataTable.
    Dim table As DataTable = CType(DataGrid1.DataSource, DataTable)
    Dim row As DataRow = table.Rows(DataGrid1.CurrentCell.RowNumber)
    row.BeginEdit
    row(1) = Edit1.Text
    If row.HasVersion(datarowversion.Proposed) Then
       If row(1, DataRowVersion.Current) Is _
            row(1, DataRowversion.Proposed) Then
          Console.WriteLine("The original and the proposed are the same")
          row.CancelEdit
          Exit Sub
       Else
          row.AcceptChanges
       End If
    Else
       Console.WriteLine("No new values proposed")
    End If
End Sub

설명

BeginEdit 자세한 내용은 메서드를 참조하세요.

적용 대상

추가 정보