i am trying to add values in two coloums of data grid view. Howeaver the result is values are concatenated instead of adding. i.e 10+25 result is 1025 and not 35.

DgvLedger.Rows.Item(GRNO).Cells(6).Value = DgvLedger.Rows.Item(PRNO).Cells(6).Value + DgvLedger.Rows.Item(GRNO).Cells(3).Value

howeaver multiplaying two coloums value result is correct.

Recommended Answers

All 2 Replies

try this

DgvLedger.Rows.Item(GRNO).Cells(6).Value = Val(DgvLedger.Rows.Item(PRNO).Cells(6).Value + DgvLedger.Rows.Item(GRNO).Cells(3).Value)

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.