DataRow.HasVersion メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataRow.HasVersion メソッドの意味・解説 

DataRow.HasVersion メソッド

指定したバージョンが存在するかどうかを示す値を取得します。

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Function HasVersion ( _
    version As DataRowVersion _
) As Boolean
Dim instance As DataRow
Dim version As DataRowVersion
Dim returnValue As Boolean

returnValue = instance.HasVersion(version)
public bool HasVersion (
    DataRowVersion version
)
public:
bool HasVersion (
    DataRowVersion version
)
public boolean HasVersion (
    DataRowVersion version
)
public function HasVersion (
    version : DataRowVersion
) : boolean

パラメータ

version

行のバージョンを指定する DataRowVersion 値の 1 つ。

戻り値
指定したバージョンが存在する場合は 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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataRow クラス
DataRow メンバ
System.Data 名前空間
AcceptChanges
BeginEdit
CancelEdit
Item
GetChildRows
GetParentRows
EndEdit
RowState



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DataRow.HasVersion メソッド」の関連用語

DataRow.HasVersion メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataRow.HasVersion メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS