DataRepeaterItem.IsCurrent Property

Gets a value that determines whether a DataRepeaterItem is the currently selected item in a DataRepeater control.

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


<BrowsableAttribute(False)> _
Public ReadOnly Property IsCurrent As Boolean
Dim instance As DataRepeaterItem 
Dim value As Boolean 

value = instance.IsCurrent
public bool IsCurrent { get; }
property bool IsCurrent {
    bool get ();
public function get IsCurrent () : boolean

Property Value

Type: System.Boolean
true if the DataRepeaterItem is the currently selected item; otherwise, false.


When IsCurrent equals True, the ItemIndex property of the DataRepeaterItem is the same as the CurrentItemIndex property of the DataRepeater control.


The following example demonstrates how to use the DrawItem event handler to display a selection indicator when an item is selected. It assumes that you have a form that contains a bound DataRepeater named DataRepeater1 that also contains an unbound PictureBox control named SelectedPictureBox.

Private Sub DataRepeater1_DrawItem(ByVal sender As Object, ByVal e _
 As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs) _
 Handles DataRepeater1.DrawItem
    ' If this is the selected item. 
    If e.DataRepeaterItem.IsCurrent Then 
        ' ...display the PictureBox.
        e.DataRepeaterItem.Controls("SelectedPictureBox"). _
         Visible = True 
        ' Otherwise, hide the PictureBox.
        e.DataRepeaterItem.Controls("SelectedPictureBox"). _
         Visible = False 
    End If 
End Sub
private void dataRepeater1_DrawItem(object sender, 
    Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs e)
    // If this is the selected item... 
    if (e.DataRepeaterItem.IsCurrent)
    // ...display the PictureBox.
        e.DataRepeaterItem.Controls["selectedPictureBox"].Visible = true;
        // Otherwise, hide the PictureBox.
        e.DataRepeaterItem.Controls["selectedPictureBox"].Visible = false;

.NET Framework Security

See Also


DataRepeaterItem Class

DataRepeaterItem Members

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

Introduction to the DataRepeater Control (Visual Studio)