Evento DataRepeater.CurrentItemIndexChanged
Aggiornamento: novembre 2007
Si verifica quando l'oggetto CurrentItemIndex viene modificato.
Spazio dei nomi: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintassi
Public Event CurrentItemIndexChanged As EventHandler
Dim instance As DataRepeater
Dim handler As EventHandler
AddHandler instance.CurrentItemIndexChanged, handler
public event EventHandler CurrentItemIndexChanged
public:
event EventHandler^ CurrentItemIndexChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
JScript non supporta gli eventi.
Note
L'oggetto CurrentItemIndex viene modificato quando l'utente seleziona un nuovo oggetto DataRepeaterItem o quando CurrentItemIndex viene impostato nel codice.
L'impostazione della proprietà CurrentItemIndex consente di scorrere l'oggetto DataRepeaterItem che presenta l'indice equivalente nella visualizzazione.
Per ulteriori informazioni sulle modalità di gestione degli eventi, vedere Utilizzo degli eventi.
Esempi
Nell'esempio riportato di seguito viene illustrato come utilizzare la proprietà CurrentItem per apportare modifiche quando viene selezionato un elemento. Nell'esempio si suppone di disporre di un form che contiene un oggetto DataRepeater associato denominato DataRepeater1, un oggetto TextBox associato denominato UnitsInStockTextBox e un oggetto Label denominato LowStockWarningLabel.
Private Sub DataRepeater1_CurrentItemIndexChanged(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles _
DataRepeater1.CurrentItemIndexChanged
' Exit if the control is first loading.
If DataRepeater1.CurrentItem Is Nothing Then Exit Sub
' Check for zero or negative quantity.
If _
CDbl(DataRepeater1.CurrentItem.Controls("UnitsInStockTextBox").Text) _
< 1 Then
' Display a the warning label on the form.
Me.LowStockWarningLabel.Visible = True
Else
Me.LowStockWarningLabel.Visible = False
End If
End Sub
private void dataRepeater1_CurrentItemIndexChanged(object sender, System.EventArgs e)
{
// Exit if the control is first loading.
if (dataRepeater1.CurrentItem == null) { return; }
// Check for zero quantity.
if (dataRepeater1.CurrentItem.Controls["unitsInStockTextBox"].Text == "0")
// Display a the warning label on the form.
{
this.lowStockWarningLabel.Visible = true;
}
else
{
this.lowStockWarningLabel.Visible = false;
}
}
Autorizzazioni
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per ulteriori informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.
Vedere anche
Riferimenti
Spazio dei nomi Microsoft.VisualBasic.PowerPacks