在datagridview中使用csharp显示选定的月份天数 [英] In datagridview display the selected month days using csharp

查看:88
本文介绍了在datagridview中使用csharp显示选定的月份天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Faculty Code Combo box(来自数据库的所有Faculty代码显示在组合框中)



工作正常。





然后我有一个日期时间选择器。



然后我有一个数据网格视图。





输出如下;


当我点击当月的日期时间选择器时
所有的日子都会显示在数据网格视图中。



我怎么能用c sharp。



它是窗口应用程序。



示例如下;



日期时间选择器我选择了1月份。



数据网格视图输出如下;



1月



2013年1月1日

2/1/2013

3/1/2013

4 / 1/2013

5/1/2013

6/1/2013

7/1/2013

8/1/2013

9/1/2013

10/1/2013

11/1/2013

12/1/2013

13/1/2013

14/1/2013

15/1/2013

16/1 / 2013

17/1/2013

18/1/2013

19/1/2013

20 / 1/2013

21/1/2013

22/1/2013

23/1/2013

24/1/2013

25/1/2013

26/1/2013

27/1/2013

28/1/2013

29/1/2013

30/1/2013

31/1/2013

Faculty Code Combo box(from the database all Faculty code is displayed in the combobox)

that is working fine.


Then i have one date time picker.

then i have one data grid view.


Output as follows;

when i click the date time picker that month all days will be displayed in the data grid view.

for that how can i do using c sharp.

it is window application.

Example as follows;

Date time picker i select the January month.

In data grid view output as follows;

January

1/1/2013
2/1/2013
3/1/2013
4/1/2013
5/1/2013
6/1/2013
7/1/2013
8/1/2013
9/1/2013
10/1/2013
11/1/2013
12/1/2013
13/1/2013
14/1/2013
15/1/2013
16/1/2013
17/1/2013
18/1/2013
19/1/2013
20/1/2013
21/1/2013
22/1/2013
23/1/2013
24/1/2013
25/1/2013
26/1/2013
27/1/2013
28/1/2013
29/1/2013
30/1/2013
31/1/2013

推荐答案

int numDays = DateTime.DaysInMonth(2013, 1);

for (int i = 1; i <= numDays; i ++)
{
  print i + "/1/2013\n";
}





根据需要修改



modify it according to your need


这篇关于在datagridview中使用csharp显示选定的月份天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆