BindingManagerBase.Position Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
En cas de substitution dans une classe dérivée, obtient ou définit la position dans la liste sous-jacente vers laquelle les contrôles liés à cette source de données pointent.
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
Valeur de propriété
Index de base zéro qui spécifie une position dans la liste sous-jacente.
Exemples
L’exemple de code suivant montre quatre méthodes qui définissent la Position propriété. La MoveNext méthode incrémente la propriété de 1. La MovePrevious méthode décrémente la propriété par 1. La MoveFirst méthode définit la propriété sur 0, et la MoveLast méthode définit la propriété sur la valeur de la Count propriété moins 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
Remarques
Utilisez la Position propriété pour itérer dans la liste sous-jacente gérée par le BindingManagerBase. Pour accéder au premier élément, définissez la Position valeur 0. Pour accéder à la fin de la liste, définissez Position la valeur de la Count propriété moins 1.
L’événement PositionChanged se produit lorsque la valeur de propriété Position change.