BindingManagerBase.Position Property

Definition

En cas de substitution dans une classe dérivée, obtient ou définit la position dans la liste sous-jacente vers laquelle pointent les contrôles liés à cette source de données.When overridden in a derived class, gets or sets the position in the underlying list that controls bound to this data source point to.

public:
 abstract property int Position { int get(); void set(int value); };
public abstract int Position { get; set; }
member this.Position : int with get, set
Public MustOverride Property Position As Integer

Property Value

Int32

Index de base zéro qui spécifie une position dans la liste sous-jacente.A zero-based index that specifies a position in the underlying list.

Examples

L’exemple de code suivant illustre quatre méthodes qui définissent la propriété Position.The following code example shows four methods that set the Position property. La méthode MoveNext incrémente la propriété de 1.The MoveNext method increments the property by 1. La méthode MovePrevious décrémente la propriété de 1.The MovePrevious method decrements the property by 1. La méthode MoveFirst affecte la valeur 0 à la propriété et la méthode MoveLast affecte à la propriété la valeur de la propriété Count moins 1.The MoveFirst method sets the property to 0, and the MoveLast method sets the property to the value of the Count property minus 1.

private:
   void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^ /*e*/ )
   {
      // Print the new value of the current object.
      Console::Write( "Current Changed: " );
      Console::WriteLine( ( (BindingManagerBase^)(sender) )->Current );
   }

   void MoveNext()
   {
      // Increment the Position property value by one.
      myBindingManagerBase->Position = myBindingManagerBase->Position + 1;
   }

   void MovePrevious()
   {
      // Decrement the Position property value by one.
      myBindingManagerBase->Position = myBindingManagerBase->Position - 1;
   }

   void MoveFirst()
   {
      // Go to the first item in the list.
      myBindingManagerBase->Position = 0;
   }

   void MoveLast()
   {
      // Go to the last row in the list.
      myBindingManagerBase->Position = myBindingManagerBase->Count - 1;
   }
private void BindingManagerBase_CurrentChanged
(object sender, EventArgs e)
{
   // Print the new value of the current object.
   Console.Write("Current Changed: ");
   Console.WriteLine(((BindingManagerBase)sender).Current);
}

private void MoveNext()
{
   // Increment the Position property value by one.
   myBindingManagerBase.Position += 1;
}

private void MovePrevious()
{
   // Decrement the Position property value by one.
   myBindingManagerBase.Position -= 1;
}

private void MoveFirst()
{
   // Go to the first item in the list.
   myBindingManagerBase.Position = 0;
}

private void MoveLast()
{
   // Go to the last row in the list.
   myBindingManagerBase.Position = 
   myBindingManagerBase.Count - 1;
}
   
Private Sub BindingManagerBase_CurrentChanged(sender As Object, e As EventArgs)
    ' Print the new value of the current object.
    Console.Write("Current Changed: ")
    Console.WriteLine(CType(sender, BindingManagerBase).Current)
End Sub


Private Sub MoveNext()
    ' Increment the Position property value by one.
    myBindingManagerBase.Position += 1
End Sub


Private Sub MovePrevious()
    ' Decrement the Position property value by one.
    myBindingManagerBase.Position -= 1
End Sub


Private Sub MoveFirst()
    ' Go to the first item in the list.
    myBindingManagerBase.Position = 0
End Sub


Private Sub MoveLast()
    ' Go to the last row in the list.
    myBindingManagerBase.Position = myBindingManagerBase.Count - 1
End Sub

Remarks

Utilisez la propriété Position pour itérer au sein de la liste sous-jacente conservée par l' BindingManagerBase.Use the Position property to iterate through the underlying list maintained by the BindingManagerBase. Pour accéder au premier élément, affectez la valeur 0 à la Position.To go to the first item, set the Position to 0. Pour atteindre la fin de la liste, affectez la valeur de la propriété Count moins 1 à la Position.To go to the end of the list, set the Position to the value of the Count property minus 1.

L’événement PositionChanged se produit lorsque la valeur de la propriété Position change.The PositionChanged event occurs when the Position property value changes.

Applies to

See also