Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Se produce cuando cambia la propiedad CurrentItemIndex.
Espacio de nombres: Microsoft.VisualBasic.PowerPacks
Ensamblado: Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintaxis
'Declaración
Public Event CurrentItemIndexChanged As EventHandler
public event EventHandler CurrentItemIndexChanged
public:
event EventHandler^ CurrentItemIndexChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
member CurrentItemIndexChanged : IEvent<EventHandler,
EventArgs>
JScript no admite eventos.
Comentarios
los cambios de CurrentItemIndex cuando el usuario selecciona nuevo DataRepeaterItem o cuando CurrentItemIndex se establece en código.
Estableciendo la propiedad de CurrentItemIndex desplaza DataRepeaterItem que tiene el índice equivalente en la vista.
Para obtener más información acerca de cómo controlar eventos, vea Utilizar eventos.
Ejemplos
El ejemplo siguiente se muestra cómo utilizar la propiedad de CurrentItem para realizar cambios cuando un elemento está seleccionado.Se supone que tiene un formulario que contiene DataRepeater enlazado denominado DataRepeater1, TextBox enlazado denominado UnitsInStockTextBox, y Label denominado LowStockWarningLabel.
Private Sub DataRepeater1_CurrentItemIndexChanged(
) 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;
}
}
Seguridad de .NET Framework
- 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)