当我们运行循环并移动列表/组合框中的项时,有没有办法通过代码移动datarepeater的项?谢谢弗尔坎
发布于 2011-01-17 22:06:55
这应该是可行的:
For i As Integer = 0 To Me.DataRepeater1.ItemCount -1
Me.DataRepeater1.CurrentItemIndex = i
Dim item As DataRepeaterItem = Me.DataRepeater1.CurrentItem
Next发布于 2013-08-23 01:54:28
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
}https://stackoverflow.com/questions/4713271
复制相似问题