DataRepeater.VirtualMode Property

Gets or sets a value that indicates whether you have provided your own data-management operations for the DataRepeater control.

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

Syntax

'Declaration
Public Property VirtualMode As Boolean
    Get
    Set
public bool VirtualMode { get; set; }
public:
property bool VirtualMode {
    bool get ();
    void set (bool value);
}
member VirtualMode : bool with get, set
function get VirtualMode () : boolean
function set VirtualMode (value : boolean)

Property Value

Type: System.Boolean
true if the DataRepeater uses data-management operations that you provide; otherwise, false. The default is false.

Remarks

Virtual mode is designed for use with large stores of data. When the VirtualMode property is set to True, you create a DataRepeater with a set number of items and then handle the ItemValueNeeded event to populate the items. Virtual mode requires implementation of an underlying data cache to handle the population, editing, and deletion of DataRepeater items based on actions of the user. For more information about how to implement virtual mode, see Virtual Mode in the DataRepeater Control.

Examples

The following code example demonstrates how to change the behavior of a DataRepeater control in the Form_Load event handler, depending on the value of the VirtualMode property. It assumes that you have a form that contains a DataRepeater control named DataRepeater1 that is bound to the Products table of the Northwind database.

' 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

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

Virtual Mode in the DataRepeater Control (Visual Studio)

How to: Disable Adding and Deleting DataRepeater Items