Solved

diffrent or sum tow colum in datagridview

Posted on 2011-02-26
5
294 Views
Last Modified: 2012-06-21
i have 4 colums
 1 - name   2- start date   3-end date  4- cost A  5-cost B

1-i want faind diffrent  date betwen c2 and c3 and in new colim name it tot_day
2- i want faind sum  c4 + c5
and c4-c5

i use visaul basic 2005
access
windose aplaction
0
Comment
Question by:ziayd2009
  • 3
  • 2
5 Comments
 
LVL 41

Expert Comment

by:graye
ID: 34989682
If you are using a DataTable to store your 5 existing columns, then you can just add a few extra columns to the DataTable.  These new columns will contain an "expression".   So, in your case, you'd add a new column for tot_day and set it's Expressio property to "[start date]-[end date]"

Take look at this article... it has some downloadable examples too.

http://www.emmet-gray.com/Articles/ADO_Expressions.htm
0
 

Author Comment

by:ziayd2009
ID: 34993386

i  use tihes cood  from example in article
 Dim dc As DataColumn
     
  LoadData()
        dc = New DataColumn("tt1")
        dc.DataType = GetType(Integer)
        dc.Expression = "tt1 + tt3"  ' two column types
        dataset3.Tables("tbl").Columns.Add(dc)
        Me.DataGridView1.DataSource = dataset3.Tables("tbl")

Open in new window

after tht it give me msg :-
Cannot set Expression property due to circular reference in the expression
why is not work
note:-
colum tt1 and tt2 is type of integr
0
 
LVL 41

Expert Comment

by:graye
ID: 34993449
Yeah, you can't call the new column by the name tt1 (in your example).   Call it something else... anything else.
0
 

Author Comment

by:ziayd2009
ID: 34993482
why ,
can  u explain more
what i can call colum ?
 can i call like tot1 or total
thank u
0
 
LVL 41

Accepted Solution

by:
graye earned 50 total points
ID: 34993882
Yeah, that'd do just fine...   the problem is that you can't create a new column using a name that already exists.  So, "total" would do just fine.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question