指定した列の値を取得または設定します。
[C#] C# では、このプロパティは DataRowView クラスのインデクサになります。
Overloads Public Default Property Item( _
ByVal ndx As Integer _) As Object
[C#]
public object this[intndx] {get; set;}
[C++]
public: __property Object* get_Item(intndx);public: __property void set_Item(intndx, Object*);
[JScript]
returnValue = DataRowViewObject.Item(ndx);DataRowViewObject.Item(ndx) = returnValue;またはreturnValue = DataRowViewObject(ndx);DataRowViewObject(ndx) = returnValue;
[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。
引数 [JScript]
- ndx
指定した列。
パラメータ [Visual Basic, C#, C++]
- ndx
指定した列。
プロパティ値
列の値。
使用例
[Visual Basic, C#, C++] DataView 内にある各 DataRowView の各項目の値を表示する例を次に示します。
Private Shared Sub WriteViewRows(dv As DataView)
Dim colCount As Integer = dv.Table.Columns.Count
' Iterate through the rows of the DataView.
Dim drv As DataRowView
Dim i As Integer
For Each drv In dv
' Display the value in each item of the DataRowView
For i = 0 To colCount
Console.Write(drv(i) & vbTab)
Next
Console.WriteLine()
Next
End Sub
[C#]
private static void WriteViewRows(DataView dv)
{
int colCount = dv.Table.Columns.Count;
// Iterate through the rows of the DataView.
foreach (DataRowView drv in dv)
{
// Display the value in each item of the DataRowView
for (int i = 0; i < colCount; i++)
Console.Write(drv[i] + "\t");
Console.WriteLine();
}
}
[C++]
private:
static void WriteViewRows(DataView* dv)
{
int colCount = dv->Table->Columns->Count;
// Iterate through the rows of the DataView.
System::Collections::IEnumerator* myEnum = dv->GetEnumerator();
while (myEnum->MoveNext())
{
DataRowView* drv = __try_cast<DataRowView*>(myEnum->Current);
// Display the value in each item of the DataRowView
for (int i = 0; i < colCount; i++)
Console::Write("{0}\t", drv->Item[i]);
Console::WriteLine();
}
};
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
DataRowView クラス | DataRowView メンバ | System.Data 名前空間 | DataRowView.Item オーバーロードの一覧