TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mike Delvotti
NA
262
0
Counting Date Fields
Aug 31 2011 7:12 AM
I'm trying to count the Date cells in my datagridview, then display the total of cells but only if the date is today.
So in brief, if my datagrid contains 2 dates that are today my label will read "2" really I would like it to say "You have 2 appointments today" in one label.
Below is some code I'm using but it's not counting correctly?
if (row.IsNewRow) break;
object obj = row.Cells[2].Value;
DateTime dt;
if (!DateTime.TryParse(obj.ToString(), out dt)&& dt.Date == DateTime.Today) count++;
{
label2.Text = count.ToString();
}
Reply
Answers (
13
)
Problem with the Crystal Report
Error in C#.net class library code