ListViewInsertEventArgs.Values プロパティ

定義

挿入するレコードの値を取得します。

public:
 property System::Collections::Specialized::IOrderedDictionary ^ Values { System::Collections::Specialized::IOrderedDictionary ^ get(); };
public System.Collections.Specialized.IOrderedDictionary Values { get; }
member this.Values : System.Collections.Specialized.IOrderedDictionary
Public ReadOnly Property Values As IOrderedDictionary

プロパティ値

IOrderedDictionary

挿入するレコードの値。

次の例は、コレクションを反復処理する方法を Values 示しています。 このコード例は、ListViewInsertEventArgs クラスのために提供されている大規模な例の一部です。

void ContactsListView_ItemInserting(Object sender, ListViewInsertEventArgs e)
{
  // Iterate through the values to verify if they are not empty.
  foreach (DictionaryEntry de in e.Values)
  {
    if (de.Value == null)
    {
      Message.Text = "Cannot insert an empty value.";
      e.Cancel = true;
    }
  }
}
Sub ContactsListView_ItemInserting(ByVal sender As Object, _
                                   ByVal e As ListViewInsertEventArgs)

  ' Iterate through the values to verify if they are not empty.
  For Each de As DictionaryEntry In e.Values
    If de.Value Is Nothing Then
      Message.Text = "Cannot insert an empty value."
      e.Cancel = True
    End If
  Next
End Sub

注釈

プロパティを Values 使用して、挿入するレコードのフィールドの値にアクセスします。 たとえば、データ ソースに挿入される前に、レコードの値を検証または HTML エンコードできます。

このプロパティは Values 、インターフェイスを OrderedDictionary 実装するオブジェクトを IOrderedDictionary 返します。 オブジェクトには OrderedDictionary 、レコードの DictionaryEntry フィールドを表すオブジェクトが含まれています。 フィールド名にアクセスするには、オブジェクトのプロパティをKeysOrderedDictionary使用します。 フィールド値にアクセスするには、プロパティを Values 使用します。

注意

ショートカットとして、オブジェクトの OrderedDictionary インデクサーを使用してフィールド値に直接アクセスできます。 インデクサーを使用する利点は、フィールド値を直接返す点です。 フィールドの順序 (など AccessDataSource) に依存するデータ ソース コントロールは、インデックスによってのみフィールド値にアクセスできます。

適用対象

こちらもご覧ください