Поделиться через


DataRepeater.VirtualModeChanged Event

Occurs when the VirtualMode property is changed.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Event VirtualModeChanged As EventHandler
public event EventHandler VirtualModeChanged
public:
 event EventHandler^ VirtualModeChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
member VirtualModeChanged : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

Remarks

Use this event to run code when the VirtualMode property is changed at run time.

For more information about how to handle events, see Consuming Events.

Examples

The following example demonstrates how to handle the VirtualModeChanged event.

' If the DataRepeater is in virtual mode, 
' do not allow adds or deletes.
If DataRepeater1.VirtualMode = True Then
    DataRepeater1.AllowUserToAddItems = False
    DataRepeater1.AllowUserToDeleteItems = False
    ' Disable the Add button.
    ProductsBindingNavigator.AddNewItem.Enabled = False
    ' Disable the Delete button.
    ProductsBindingNavigator.DeleteItem.Enabled = False
End If
// If the DataRepeater is in virtual mode, 
// do not allow adds or deletes.
if (dataRepeater1.VirtualMode == true)
{
    dataRepeater1.AllowUserToAddItems = false;
    dataRepeater1.AllowUserToDeleteItems = false;
    // Disable the Add button.
    productsBindingNavigator.AddNewItem.Enabled = false;
    // Disable the Delete button.
    productsBindingNavigator.DeleteItem.Enabled = false;
}

.NET Framework Security

See Also

Reference

DataRepeater Class

Microsoft.VisualBasic.PowerPacks Namespace

VirtualMode

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

Virtual Mode in the DataRepeater Control (Visual Studio)