Sum UP datagrid 's content fail in 2005

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

my datagrid is for user to input the debit, credit .
after input the amount , I will call an Method CalTotalDebitCredit() and it
will sum up the debit/ credit and then place
to the Total textBox. Everything works fine in 2003, BUT now, as I switch to
2005, it didn't works.

Private Sub dtGLJnDetail_ColumnChanged(.............
select case column
case 8 (Debit Side)
Me.CalTotalDebitCredit()
case 9 (Credit Side)
Me.CalTotalDebitCredit()
end select
end sub .....

prviate sub CalTotalDebitCredit
Dim numRows As Integer =
dgDetail.BindingContext(dgDetail.DataSource, dgDetail.DataMember).Count
If numRows = 0 Then Exit Sub

Dim intSeq As Integer = 0
Dim intCounter As Integer = 1
Dim decTtlDebit As Decimal = 0.0
Dim decTtlCredit As Decimal = 0.0

Dim drGLJnHeader As DataRow =
dtGLJnHeader.Rows(bmGLJnHeader.Position)
intSeq = 0
For intSeq = 0 To numRows - 1
decTtlDebit += Me.dgDetail(intSeq, 8)
decTtlCredit += Me.dgDetail(intSeq, 9)

intCounter += 1
Next

Me.txtTtlDebit.Text = decTtlDebit.ToString("#0.00")
Me.txtTtlCredit.Text = decTtlCredit.ToString("#0.00")

dgDetail.CurrentCell = New DataGridCell(intCurrentRow,
intCurrentCol)
' I had already move back the cursor in the current row, however, it
only move to the first row
end sub
 
I found the problem . the following code is work .
in my orginal code, there is bmGlJnheader.current.item("ttldebit") =
decTtlDebit <--- when I omit this , everything works
 
Back
Top