Click here to Skip to main content
13,052,696 members (63,077 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i have tow date picker as follows.

Datepicker1 DAtepicker2
when i choose datepicker1 8th day as monday in the datepicker 2 13th day saturday automically display in the datepicker2 no problem.

i want the output as

that 8th to 13th date will be diplayed in the row wise as follows.when i click the button.

what date i choose in the datepicker1 add 5 days and display that date to the datepicker2.when i click the load button that date to be displayed in the row wise in the date grid.
output as follows

  DAte SS      GS     VR    CKK    CNN    RV   MS    TSS    CM
   8   1
   8   2
   8   3
   9   1
   9   2
   9   3
   10  1
   10  2
   10  3
   11  1
   11  2
   11  3
   12  1
   12  2
   12  3
   13  1
   13  2
   13  3

for that output how to write the code using csharp in windows application.

[edit]Code block added - OriginalGriff[/edit]
Posted 6-Jan-13 1:48am
Updated 6-Jan-13 2:28am
Sandeep Mewara 6-Jan-13 8:21am
OK, and where did you got stuck?
Plyswthsqurles 6-Jan-13 16:52pm
Is this tied to a database? Need to know so can write query as well for this.

All you should need to do is create a method that loads the data grid, passes in the two dates and then your sql will have a BETWEEN clause that defines the Date between date picker 1 and date picker 2.

If you provide answer i can write snippet.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can try something like this. This is just a sample code for your thought you can modify this code based on your need.
private void UpdateGrid(DateTime time, int noOfDays)
  for (int i = 1; i <= noOfDays; i++)
     DateTime newDate = time.AddDays(i);
     for (int newIndex = 0; newIndex < 3; newIndex++)
       DataGridViewRow row = new DataGridViewRow();
       row.Cells[0].Value = newDate.ToShortDateString();
       row.Cells[1].Value = newIndex;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100