Click here to Skip to main content
15,912,021 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am trying the code to get values of totals in a devexpress textedit control from a Gridcontrol Column. It is showing the total but total value is not correct.

Problem is appearing here
(GridView1.Columns.View.GetFocusedRowCellValue("NET PRFIT", I))


Can anyone please help me for the solution? Thanks.

What I have tried:

VB
End Try
        Dim solprofit As Double = 0
        Dim retproft As Double = 0
        For I As Integer = 0 To GridView1.RowCount - 1
            Try

                solprofit = solprofit + CDbl(GridView1.Columns.View.GetFocusedRowCellValue("NET PRFIT", I))

            Catch ex As Exception

            End Try
Next
TxtOpCrTotal.Text = FormatNumber(solprofit)
Posted
Updated 5-Mar-17 7:49am

1 solution

 
Share this answer
 
Comments
UCP_2005 5-Mar-17 14:22pm    
Thanks Graeme.

I checked the links but I created the grid columns through code.

SqlStr = "SELECT TRANSCODE,transdate as [Invoice Date],qutono as [Invoice No],(select top 1 ledgername from StockInvoiceDetails where StockInvoiceDetails.transcode=StockInvoiceRowItems.transcode) AS [Customer Name], SUM(N1) AS [NET PRFIT] FROM StockInvoiceRowItems " & Wherestr & " AND VOUCHERNAME IN ('POS','SD','SR') "

Will it work if I create the columns manually in GridControl by giving the same Name and captions?
Thanks for your support.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900