DataRepeater.CurrentItemIndexChanged (Evento)
Actualización: noviembre 2007
Se produce cuando cambia CurrentItemIndex.
Espacio de nombres: Microsoft.VisualBasic.PowerPacks
Ensamblado: Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintaxis
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 no admite eventos.
Comentarios
CurrentItemIndex cambia cuando el usuario selecciona un nuevo DataRepeaterItem o cuando la propiedad CurrentItemIndex se establece en el código.
Al establecer la propiedad CurrentItemIndex, el DataRepeaterItem que tiene el índice equivalente se desplaza en la vista.
Para obtener más información sobre cómo controlar los eventos, vea Utilizar eventos.
Ejemplos
En el ejemplo siguiente se muestra cómo utilizar la propiedad CurrentItem para realizar cambios cuando hay un elemento seleccionado. Se supone que tiene un formulario que contiene un DataRepeater enlazado denominado DataRepeater1, un TextBox enlazado denominado UnitsInStockTextBox y un Label denominado 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;
}
}
Permisos
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.
Vea también
Referencia
Microsoft.VisualBasic.PowerPacks (Espacio de nombres)