VirtualMode Property
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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 (in Microsoft.VisualBasic.PowerPacks.dll)

public bool VirtualMode { get; set; }

Property Value

Type: System.Boolean

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

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.

The following code example demonstrates how to change the behavior of a DataRepeater control, 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.

Private Sub Form1_Load(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles MyBase.Load
    ' 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
End Sub

Show:
© 2016 Microsoft