datagrid column

hi

    I have a datagrid with three columns.

Gross Amt.        Net Amt.      Difference.

I have to display in the Difference column the difference between GrossAmt and Net Amt.      How to do it.


tx
sandeep
sandeep437Asked:
Who is Participating?
 
RonaldBiemansConnect With a Mentor Commented:
Lets assume you have a dataset with a datatable

        ds.Tables(0).Columns("difference").Expression = "GrossAmt - NetAmt"
0
 
sandeep437Author Commented:
ok i will try it.


tx
sandeep
0
 
J_MakCommented:
Try this:

Dim row1 as Datarow = ds.Tables("Name of your table").Row("whichever row you want")
ds.Tables("Name of your table").Columns("Difference") = row1("Gross Amt") - row1("Net Amt")

I hope that helps!
0
 
ahmadfuwadCommented:
'fill your dataset with following querry it will solve your problem
select GrossAmt,NetAmt,GrossAmt-NetAmt as [Difference] from table_name
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.