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

public event EventHandler VirtualModeChanged
public:
event EventHandler^ VirtualModeChanged {
    void add(EventHandler^ value);
    void remove(EventHandler^ value);
}
member VirtualModeChanged : IEvent<EventHandler,
    EventArgs>
Public Event VirtualModeChanged As EventHandler

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 Handling and Raising 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)
{
    dataRepeater1.AllowUserToAddItems = false;
    dataRepeater1.AllowUserToDeleteItems = false;
    // Disable the Add button.
    productsBindingNavigator.AddNewItem.Enabled = false;
    // Disable the Delete button.
    productsBindingNavigator.DeleteItem.Enabled = false;
}
' 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

See Also

VirtualMode
DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)
Virtual Mode in the DataRepeater Control (Visual Studio)

Return to top