DataRepeater.FirstDisplayedItemIndex Property

Gets the index of the first currently displayed DataRepeaterItem in a DataRepeater control.

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


<BrowsableAttribute(False)> _
Public ReadOnly Property FirstDisplayedItemIndex As Integer
Dim instance As DataRepeater 
Dim value As Integer 

value = instance.FirstDisplayedItemIndex
public int FirstDisplayedItemIndex { get; }
property int FirstDisplayedItemIndex {
    int get ();
public function get FirstDisplayedItemIndex () : int

Property Value

Type: System.Int32
The index of the first displayed DataRepeaterItem.


Use this property to determine which item or items are currently visible in the DataRepeater control. This will always return the first item (topmost if the LayoutStyle is set to Vertical, leftmost if LayoutStyle is set to Horizontal) even if that item is only partially visible.


The FirstDisplayedItemIndex is not necessarily the same as the CurrentItemIndex. The CurrentItemIndex represents the selection, whereas the FirstDisplayedItemIndex represents the visible items even when the selection is scrolled out of view.


The following code example demonstrates how to make the first displayed item the currently selected item in a DataRepeater control. It assumes that you have a form that contains a DataRepeater control named DataRepeater1 and a Button control named SynchButton.

Private Sub SynchButton_Click(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles SynchButton.Click
    ' If the first displayed item is not the current item. 
    If DataRepeater1.FirstDisplayedItemIndex <> _
     DataRepeater1.CurrentItemIndex Then 
        ' Make it the current item.
        DataRepeater1.CurrentItemIndex = _
    End If 
End Sub
private void synchButton_Click(System.Object sender, System.EventArgs e)
    // If the first displayed item is not the current item. 
    if (dataRepeater1.FirstDisplayedItemIndex != dataRepeater1.CurrentItemIndex)
    // Make it the current item.
        dataRepeater1.CurrentItemIndex = dataRepeater1.FirstDisplayedItemIndex;

.NET Framework Security

See Also


DataRepeater Class

DataRepeater Members

Microsoft.VisualBasic.PowerPacks Namespace



Other Resources

Introduction to the DataRepeater Control (Visual Studio)