CurrencyManager.Position プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As CurrencyManager Dim value As Integer value = instance.Position instance.Position = value
0 から Count -1 までの数値。

Position プロパティは、CurrencyManager クラスの重要なプロパティです。項目のリストでは、リスト全体のうち 1 つの項目のみ表示できます。表示する項目を決定するには、Position を 0 (リストの先頭) から Count -1 (リストの末尾) までの数値に設定します。
したがって、Position は、同じ CurrencyManager にバインドされているすべてのコントロールの現在性、つまりリスト内の位置を決定します。たとえば、"FirstName" および "LastName" という 2 つの列で構成されるリストがあるとします。このリストには、2 つの TextBox コントロールがバインドされています。つまり、一方のコントロールは最初の列に、もう一方のコントロールは 2 番目の列にバインドされています。共通する CurrencyManager の Position が 3 番目の位置に設定されている場合、どちらのコントロールにも、リスト内のその位置に相当する値が表示されます。つまり、3 番目の位置にある項目が "John" という名前と "Smith" という姓で構成されている場合、バインド コントロールには "John" と "Smith" が表示されます。

Position プロパティを使用してリスト内を移動できるようにするコード例を次に示します。
Private Sub MoveNext(ByVal myCurrencyManager As CurrencyManager) If myCurrencyManager.Count = 0 Then Console.WriteLine("No records to move to.") Exit Sub End If If myCurrencyManager.Position = myCurrencyManager.Count - 1 Then MessageBox.Show("You're at end of the records") Else myCurrencyManager.Position += 1 End If End Sub Private Sub MoveFirst(ByVal myCurrencyManager As CurrencyManager) If myCurrencyManager.Count = 0 Then Console.WriteLine("No records to move to.") Exit Sub End If myCurrencyManager.Position = 0 End Sub Private Sub MovePrevious(ByVal myCurrencyManager As CurrencyManager) If myCurrencyManager.Count = 0 Then Console.WriteLine("No records to move to.") Exit Sub End If If myCurrencyManager.Position = 0 Then MessageBox.Show("You're at the beginning of the records.") Else myCurrencyManager.Position -= 1 End if End Sub Private Sub MoveLast(ByVal myCurrencyManager As CurrencyManager) If myCurrencyManager.Count = 0 Then Console.WriteLine("No records to move to.") Exit Sub End If myCurrencyManager.Position = myCurrencyManager.Count - 1 End Sub
private void MoveNext(CurrencyManager myCurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } if (myCurrencyManager.Position == myCurrencyManager.Count - 1){ Console.WriteLine("You're at end of the records"); } else{ myCurrencyManager.Position += 1; } } private void MoveFirst(CurrencyManager myCurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } myCurrencyManager.Position = 0; } private void MovePrevious(CurrencyManager myCurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } if(myCurrencyManager.Position == 0) { Console.WriteLine("You're at the beginning of the records."); } else{ myCurrencyManager.Position -= 1; } } private void MoveLast(CurrencyManager myCurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } myCurrencyManager.Position = myCurrencyManager.Count - 1; }
private: void MoveNext( CurrencyManager^ myCurrencyManager ) { if ( myCurrencyManager->Count == 0 ) { Console::WriteLine( "No records to move to." ); return; } if ( myCurrencyManager->Position == myCurrencyManager->Count - 1 ) { Console::WriteLine( "You're at end of the records" ); } else { myCurrencyManager->Position += 1; } } void MoveFirst( CurrencyManager^ myCurrencyManager ) { if ( myCurrencyManager->Count == 0 ) { Console::WriteLine( "No records to move to." ); return; } myCurrencyManager->Position = 0; } void MovePrevious( CurrencyManager^ myCurrencyManager ) { if ( myCurrencyManager->Count == 0 ) { Console::WriteLine( "No records to move to." ); return; } if ( myCurrencyManager->Position == 0 ) { Console::WriteLine( "You're at the beginning of the records." ); } else { myCurrencyManager->Position -= 1; } } void MoveLast( CurrencyManager^ myCurrencyManager ) { if ( myCurrencyManager->Count == 0 ) { Console::WriteLine( "No records to move to." ); return; } myCurrencyManager->Position = myCurrencyManager->Count - 1; }
private void MoveNext(CurrencyManager myCurrencyManager) { if (myCurrencyManager.get_Count() == 0) { Console.WriteLine("No records to move to."); return ; } if (myCurrencyManager.get_Position() == myCurrencyManager.get_Count() - 1) { Console.WriteLine("You're at end of the records"); } else { myCurrencyManager.set_Position( myCurrencyManager.get_Position() + 1); } } //MoveNext private void MoveFirst(CurrencyManager myCurrencyManager) { if (myCurrencyManager.get_Count() == 0) { Console.WriteLine("No records to move to."); return ; } myCurrencyManager.set_Position(0); } //MoveFirst private void MovePrevious(CurrencyManager myCurrencyManager) { if (myCurrencyManager.get_Count() == 0) { Console.WriteLine("No records to move to."); return; } if (myCurrencyManager.get_Position() == 0) { Console.WriteLine("You're at the beginning of the records."); } else { myCurrencyManager.set_Position( myCurrencyManager.get_Position() - 1); } } //MovePrevious private void MoveLast(CurrencyManager myCurrencyManager) { if (myCurrencyManager.get_Count() == 0) { Console.WriteLine("No records to move to."); return ; } myCurrencyManager.set_Position(myCurrencyManager.get_Count() - 1); } //MoveLast
private function MoveNext(myCurrencyManager : CurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } if (myCurrencyManager.Position == myCurrencyManager.Count - 1){ Console.WriteLine("You're at end of the records"); } else{ myCurrencyManager.Position += 1; } } private function MoveFirst(myCurrencyManager : CurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } myCurrencyManager.Position = 0; } private function MovePrevious(myCurrencyManager : CurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } if(myCurrencyManager.Position == 0) { Console.WriteLine("You're at the beginning of the records."); } else{ myCurrencyManager.Position -= 1; } } private function MoveLast(myCurrencyManager : CurrencyManager){ if(myCurrencyManager.Count == 0) { Console.WriteLine("No records to move to."); return; } myCurrencyManager.Position = myCurrencyManager.Count - 1; }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からCurrencyManager.Position プロパティを検索する場合は、下記のリンクをクリックしてください。

- CurrencyManager.Position プロパティのページへのリンク