【发布时间】:2013-05-11 04:36:35
【问题描述】:
我正在使用 foreach 按列循环进入网格,在循环进入一列时,我必须进行验证并循环到下一个可见列,即验证并重置列单元格的图像。
//代码
For Each col In Me.TransactionsGrid.Rows.Band.Columns
If (col.Hidden = False) Then
'Get the first cell of the first column in the grid
cell= row.Cells(col.Index)
'Set the cell image
cell.Appearance.Image = My.Resources.Tran_comment_161
cell.Appearance.ImageHAlign = HAlign.Right
cell.Appearance.ImageVAlign = VAlign.Top
'Loop in to the next visible column and reset the image of the cell
//Code here
cell= row.Cells(UltraGridColumn.Index + 1)
'Reset the cell image
cell.Appearance.ResetImage()
Exit For
End If
Next
我怎样才能做到这一点?
【问题讨论】:
-
不要用类名(UltraGridColumn、UltraGridRow、UltraGridCell)调用这些变量。这非常令人困惑。你的实际代码有什么问题?
-
这工作正常,但我需要修改,如果当前在第二列中的循环我需要并行循环第三列并重置单元格。
-
让我明白。您需要在每一行上循环,如果当前行第二列中的值无效,则重置当前行第三列中的图像?
-
主要逻辑是,我必须在某些条件下为某些行设置第一列中的图像,如果用户隐藏该列,则该列中设置的图像应该移动到第一列现在可见。如果他撤销该列以使其可见,则图像应再次移回。我说清楚了吗?
标签: .net vb.net foreach ultrawingrid