浏览datarepeater的项目

Fur*_*gal 4 vb.net datarepeater

有没有办法通过代码移动datarepeater的项目,因为我们运行循环并移动列表/组合框中的项目?谢谢Furqan

C P*_*ins 5

Schmelter的代码更改了当前行,但这可能会产生不良影响,因为它可以更新UI并导致其他数据处理事件触发.没有必要更改CurrentItemIndex以循环DataRepeaterItems.每个DataRepeaterItem只是DataRepeater.Controls集合中的Control对象.这是一个替代方案(在C#中):

    using Microsoft.VisualBasic.PowerPacks; 
    foreach ( DataRepeaterItem rowItem in dataRepeater1.Controls )
    {
        int itemIndex = rowItem.ItemIndex;

        // If it's bound, get the underlying data object
        object dataItem = BindingSource1.List[itemIndex];

        // Add code for each rowItem of the dataItem
        // All controls on the DataRepeateItem can be obtained from rowItem.Controls  
    }
Run Code Online (Sandbox Code Playgroud)