BindingManagerBase.Position Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
In caso di override in una classe derivata, ottiene o imposta la posizione nell'elenco sottostante a cui sono associati i controlli associati a questo punto di origine dati.
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
Valore della proprietà
Indice in base zero che specifica una posizione nell'elenco sottostante.
Esempio
Nell'esempio di codice seguente vengono illustrati quattro metodi che impostano la Position proprietà . Il MoveNext metodo incrementa la proprietà di 1. Il MovePrevious metodo decrementa la proprietà di 1. Il MoveFirst metodo imposta la proprietà su 0 e il MoveLast metodo imposta la proprietà sul valore della Count proprietà meno 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
Commenti
Utilizzare la Position proprietà per scorrere l'elenco sottostante gestito da BindingManagerBase. Per passare al primo elemento, impostare su Position 0. Per passare alla fine dell'elenco, impostare sul Position valore della Count proprietà meno 1.
L'evento PositionChanged si verifica quando cambia il valore della Position proprietà.