Hi Every one!
i have a data gridview consisting of four column
total_time,Start_time,End_Time,Day
all are of date/time data types.
i want to add the first to columns Total_Time and Start_Time and show the result into third column End_Time and the coresponding day in the fourth column Day.
the total_Time may consist of more then 24 hours. I am trying to do this for three days but i can't......
How i can do this in c#(visual studio 2005) connected to Ms Acces Database.
Thnx.....

Recommended Answers

All 6 Replies

You can either construct SELECT statement to do the calculation or override GridView DataBound event handler to perform the calculation, please mention are you working in web-based\windows-based application?

Thank you for ur reply.
I am working in window base application.
Thnx

Good, please mention your SELECT statement.

my code to solve this problem is as below

TimeSpan spanTotal = ((DateTime)dataGridView1.Rows[i].Cells[2].Value).TimeOfDay;
TimeSpan spanTimeStart = ((DateTime)dataGridView1.Rows[i].Cells[3].Value).TimeOfDay;
TimeSpan spantTiemEnd = spanTimeStart.Add(spanTotal);

this add the two times but when the time exceed from 24 hours it stop. for example if i need to add 26:30Hours with 11:10 Am then it does not work

and what this time "26:30Hours" represents?!!!

26:30 Hours represent 26 Hours and 30 minutes which i want to add with 11:10 Am which represents a time of day.
Example i mean i want to add
(11:10 AM Monday)+(26:30)=(2:40 PM Tuesday)

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.