CurrencyManager クラスとは? わかりやすく解説

CurrencyManager クラス

Binding オブジェクトリスト管理します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Class CurrencyManager
    Inherits BindingManagerBase
Dim instance As CurrencyManager
public class CurrencyManager : BindingManagerBase
public ref class CurrencyManager : public
 BindingManagerBase
public class CurrencyManager extends BindingManagerBase
public class CurrencyManager extends
 BindingManagerBase
解説解説

CurrencyManager は、BindingManagerBase クラスから派生します。CurrencyManager または PropertyManager を返すには、BindingContext を使用します返される実際オブジェクトは、BindingContextItem プロパティ渡されデータ ソースおよびデータ メンバによって異なりますデータ ソース単一プロパティだけを返すことができるオブジェクトであり、オブジェクトリストではない場合オブジェクトの型は PropertyManagerなります。たとえば、データ ソースとして TextBox指定すると、PropertyManager返されます。一方データ ソースが、IList、IListSource、または IBindingList の各インターフェイス実装している場合は、CurrencyManager返されます。

Current プロパティは、基になるリストにある現在の項目を返します現在の項目を変更するには、Position プロパティ新しい値に設定します。この値は、0 より大きい値で、Count プロパティの値より小さい値である必要があります

基になるデータ ソースIBindingList インターフェイス実装し、AllowNew プロパティtrue設定すると、AddNew メソッド使用できます

使用例使用例

TextBox コントロールを DataTable の列にバインドし、このバインディングCurrencyManager取得して、その位置設定するコード例次に示します

' Place the next line into the Declarations section of the form.
 Private myCurrencyManager As CurrencyManager
 
 Private Sub BindControl(myTable As
 DataTable)
    ' Bind a TextBox control to a DataTable column in a DataSet.
    TextBox1.DataBindings.Add("Text", myTable, "CompanyName")
    ' Specify the CurrencyManager for the DataTable.
    myCurrencyManager = CType(me.BindingContext(myTable), CurrencyManager)
    ' Set the initial Position of the control.
    myCurrencyManager.Position = 0
 End Sub
 
 Private Sub MoveNext(myCurrencyManager As
 CurrencyManager)
    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(myCurrencyManager As
 CurrencyManager)
    myCurrencyManager.Position = 0
 End Sub
 
 Private Sub MovePrevious(myCurrencyManager
 As CurrencyManager)
    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(myCurrencyManager As
 CurrencyManager)
    myCurrencyManager.Position = myCurrencyManager.Count - 1
 End Sub

private CurrencyManager myCurrencyManager;
 
 private void BindControl(DataTable myTable){
    // Bind a TextBox control to a DataTable column in a DataSet.
    textBox1.DataBindings.Add("Text", myTable, "CompanyName");
    // Specify the CurrencyManager for the DataTable.
    myCurrencyManager = (CurrencyManager)this.BindingContext[myTable];
    // Set the initial Position of the control.
    myCurrencyManager.Position = 0;
 }
 
 private void MoveNext(CurrencyManager myCurrencyManager){
    if (myCurrencyManager.Position == myCurrencyManager.Count
 - 1){
       MessageBox.Show("You're at end of the records");
    }
    else{
      myCurrencyManager.Position += 1;
    }
 }
 
 private void MoveFirst(CurrencyManager myCurrencyManager){
    myCurrencyManager.Position = 0;
 }
 
 private void MovePrevious(CurrencyManager
 myCurrencyManager ){
    if(myCurrencyManager.Position == 0) {
       MessageBox.Show("You're at the beginning of the records.");
    }   
    else{
       myCurrencyManager.Position -= 1;
    }
 }
 
 private void MoveLast(CurrencyManager myCurrencyManager){
    myCurrencyManager.Position = myCurrencyManager.Count - 1;
 }

CurrencyManager^ myCurrencyManager;
void BindControl( DataTable^ myTable )
{
   
   // Bind a TextBox control to a DataTable column in a DataSet.
   textBox1->DataBindings->Add( "Text", myTable, "CompanyName"
 );
   
   // Specify the CurrencyManager for the DataTable.
   this->myCurrencyManager = dynamic_cast<CurrencyManager^>(this->BindingContext[
 myTable ]);
   
   // Set the initial Position of the control.
   this->myCurrencyManager->Position = 0;
}

void MoveNext( CurrencyManager^ myCurrencyManager )
{
   if ( myCurrencyManager->Position == myCurrencyManager->Count
 - 1 )
   {
      MessageBox::Show( "You're at end of the records" );
   }
   else
   {
      myCurrencyManager->Position += 1;
   }
}

void MoveFirst( CurrencyManager^ myCurrencyManager )
{
   myCurrencyManager->Position = 0;
}

void MovePrevious( CurrencyManager^ myCurrencyManager )
{
   if ( myCurrencyManager->Position == 0 )
   {
      MessageBox::Show( "You're at the beginning of the records." );
   }
   else
   {
      myCurrencyManager->Position -= 1;
   }
}

void MoveLast( CurrencyManager^ myCurrencyManager )
{
   myCurrencyManager->Position = myCurrencyManager->Count - 1;
}

private var myCurrencyManager : CurrencyManager;

private function BindControl(myTable : DataTable){
   // Bind a TextBox control to a DataTable column in a DataSet.
   textBox1.DataBindings.Add("Text", myTable, "CompanyName");
   // Specify the CurrencyManager for the DataTable.
   myCurrencyManager = CurrencyManager(this.BindingContext[myTable]);
   // Set the initial Position of the control.
   myCurrencyManager.Position = 0;
}

private function MoveNext(myCurrencyManager
 : CurrencyManager){
   if (myCurrencyManager.Position == myCurrencyManager.Count -
 1){
      MessageBox.Show("You're at end of the records");
   }
   else{
     myCurrencyManager.Position += 1;
   }
}

private function MoveFirst(myCurrencyManager
 : CurrencyManager){
   myCurrencyManager.Position = 0;
}

private function MovePrevious(myCurrencyManager
 : CurrencyManager){
   if(myCurrencyManager.Position == 0) {
      MessageBox.Show("You're at the beginning of the records.");
   }   
   else{
      myCurrencyManager.Position -= 1;
   }
}

private function MoveLast(myCurrencyManager
 : CurrencyManager){
   myCurrencyManager.Position = myCurrencyManager.Count - 1;
}

継承階層継承階層
System.Object
   System.Windows.Forms.BindingManagerBase
    System.Windows.Forms.CurrencyManager
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CurrencyManager クラス」の関連用語

CurrencyManager クラスのお隣キーワード
検索ランキング

   

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



CurrencyManager クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS