0

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.....

2
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by ejazmusavi
0

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?

0

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

0

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

0

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)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.