1

Infragistics Ultragrid 2008 を使用しています。グリッドで選択した列をチェックおよびチェック解除するためのボタンがあります。

ボタンをクリックしたときに行フィルターがアクティブになっている場合でも、非表示の行の選択された列もチェックされます。

表示されている行に対してのみ、選択した列をtrueに設定したい。vb.net 2008 のコードを教えてください

これは私が今使っているコードです

    Me.lbltotal.Text = "0.00"

    Dim i As Integer = 0

    Dim nDx As Boolean = False
    If Me.btnSelectAll.Text = "Select All" Then
        nDx = True
    Else
        nDx = False
    End If

    While i < Me.UninvoicedMemosDataGrid.Rows.Count

        Me.UninvoicedMemosDataGrid.Rows(i).Cells(9).Value = nDx
        Me.UninvoicedMemosDataGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode)
        Me.UninvoicedMemosDataGrid.Update()
        i += 1
    End While

    If Me.btnSelectAll.Text = "Select All" Then
        Me.btnSelectAll.Text = "Deselect All"
    Else
        Me.btnSelectAll.Text = "Select All"
    End If


    Dim r As Integer
    Dim sum As Single = 0.0
    For r = 0 To UninvoicedMemosDataGrid.Rows.Count - 1
       If UninvoicedMemosDataGrid.Rows(r).Cells(9).Value() = True Then sum += UninvoicedMemosDataGrid.Rows(r).Cells(8).Value()

        Me.lbltotal.Text = sum
    Next
    Dim n As Integer
    n = Me.lbltotal.Text
    lbltotal.Text = n.ToString("###,##0.00")
4

1 に答える 1

3

現在の列フィルターによって非表示にされていない行にのみ計算を適用することを意図している場合は、この方法でループを変更する必要があります

For each row in Me.UninvoicedMemosDataGrid.Rows.GetFilteredInNonGroupByRows()
    row.Cells(9).Value = nDx
Next
' Only one cell could be in edit mode, so this should go outside the loop '
row.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode)
' same for data updating....'
Me.UninvoicedMemosDataGrid.Update()

そしてこれ(上記のコードに基づいて、これはすべての行に対して常にtrueまたはfalseになるはずです)

For each row in UninvoicedMemosDataGrid.Rows.GetFilteredInNonGroupByRows()
   If row.Cells(9).Value() = True Then 
       sum += row.Cells(8).Value
   End if
Next
Me.lbltotal.Text = sum

ただし、ここでの意図はよくわかりません。これがあなたが探しているものかどうか、または私があなたの意図を誤解したかどうかをお知らせください.

于 2012-12-06T23:53:11.167 に答える