的MonthCalendar [英] MonthCalendar

查看:80
本文介绍了的MonthCalendar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个月份日历,我希望用户能够

选择一系列日期(或单个日期)然后根据数量计算

a值那个人选择了
的日子。周末的价值更高,所以我需要能够计算出工作日和周末所选择的

天数。

我已经有代码告诉我

人选择的天数。我也明白如何获得

DayOfWeek。我试图编写一个嵌套的if语句,

将检查dayofweek,看看它周末离

有多远,然后根据

天用户选择但它已经变得笨拙了,

好​​,看起来很疯狂。


我希望有人可以告诉我一个更简单的编码

方法。我的另一个想法是,也许它可能会与SelectedRange有关吗?我想也许

有一种方法可以循环选择范围,看看每个周末的每周周末是否为
,但是

我真的不知道我会怎么做(如果它甚至可能是
),特别是因为dayofweek给出一个整数,而

selectedrange给出了日期。


Oy!


我们非常感谢任何帮助。


谢谢。

解决方案

嗨沙,


如果您希望我们帮助您使代码更简单,我想我们<首先要看



只是想一想,


Cor

我有一个月份日历,我希望用户能够选择一系列日期(或单个日期),然后根据该人的天数计算一个值
已选中。周末的价值更高,所以我需要能够弄清楚有多少选定的工作日是周末和周末。

我已经有代码告诉我了
人选择的天数。我也明白如何获得
DayOfWeek。我试着编写一个嵌套的if语句,它会检查周日,查看周末离它有多远,然后根据用户选择的
天数检查它变得笨拙,好吧,看起来很疯狂。

我希望有人可以告诉我一个更简单的编码方法。我的另一个想法是,它可能与SelectedRange有关吗?我想也许
有一种方法可以循环选择范围,看看每个周末的每天周日是否落在这个范围内但是
我真的不知道我会怎么做(如果它甚至是可能的话,特别是因为dayofweek给出了一个整数,而
selectedrange给出了日期。



*" Sand" ; <一个******* @ discussions.microsoft.com> scripsit:

我有一个月份日历,我希望用户能够选择一系列日期(或单个日期),然后根据数量计算一个值。这个人已被选中的日子。周末的价值更高,所以我需要能够弄清楚有多少选定的工作日是周末和周末。

我已经有代码告诉我了
人选择的天数。我也明白如何获得
DayOfWeek。我试着编写一个嵌套的if语句,它会检查周日,查看周末离它有多远,然后根据用户选择的
天数检查它变得笨拙,好吧,看起来很疯狂。

我希望有人可以告诉我一个更简单的编码方法。我的另一个想法是,它可能与SelectedRange有关吗?我想也许
有一种方法可以循环选择范围,看看每个周末的每天周日是否落在这个范围内但是
我真的不知道我会怎么做(如果它甚至是可能的话,特别是因为dayofweek给出了一个整数,而
selectedrange给出了日期。




邮政编码!


-

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>


Hi Sand,

首先,设置2个月的日历控件 - 开始和结束。然后让用户

如果只有一天选择相同的日期。然后看看

datediff函数来确定日期范围。


HTH,


Bernie Yaeger


" Sand" <一个******* @ discussions.microsoft.com>在消息中写道

news:06 **************************** @ phx.gbl ... < blockquote class =post_quotes>我有一个月份日历,我希望用户能够选择一系列日期(或单个日期),然后根据该人的天数计算一个值已经选择了。周末的价值更高,所以我需要能够弄清楚有多少选定的工作日是周末和周末。

我已经有代码告诉我了
人选择的天数。我也明白如何获得
DayOfWeek。我试着编写一个嵌套的if语句,它会检查周日,查看周末离它有多远,然后根据用户选择的
天数检查它变得笨拙,好吧,看起来很疯狂。

我希望有人可以告诉我一个更简单的编码方法。我的另一个想法是,它可能与SelectedRange有关吗?我想也许
有一种方法可以循环选择范围,看看每个周末的每天周日是否落在这个范围内但是
我真的不知道我会怎么做(如果它甚至是可能的话,特别是因为dayofweek给出一个整数而
selectedrange给出了日期。

Oy!

任何帮助都会很大谢谢。

谢谢。



I have a monthCalender that I want users to be able to
select a range of dates (or a single date) then calculate
a value based on the number of days that person has
selected. The values are higher for the weekends so I
need to be able to figure out how many of the selected
days are weekdays versus weekends.

I already have code to tell me the number of days the
person has selected. I also understand how to get the
DayOfWeek. I tried to code an nested if statement that
would check the dayofweek, see how far away from the
weekend it is and then check that against the number of
days the user selected but it has become unwieldly and,
well, pretty crazy looking.

I''m hoping that someone can tell me a simpler coding
method. My other thought was maybe it''s possible
something to do with the SelectedRange? I thought maybe
there is a way to loop through selected range to see if
dayofweek for each weekend day fell inside that range but
I really don''t know how I would do that (if it''s even
possible)especially since dayofweek gives an integer while
selectedrange gives dates.

Oy!

Any help would be greatly appreciated.

Thank you.

解决方案

Hi Sand,

If you want us to help you to make your code more simple, than I think we
first have to see that.

Just a thought,

Cor

I have a monthCalender that I want users to be able to
select a range of dates (or a single date) then calculate
a value based on the number of days that person has
selected. The values are higher for the weekends so I
need to be able to figure out how many of the selected
days are weekdays versus weekends.

I already have code to tell me the number of days the
person has selected. I also understand how to get the
DayOfWeek. I tried to code an nested if statement that
would check the dayofweek, see how far away from the
weekend it is and then check that against the number of
days the user selected but it has become unwieldly and,
well, pretty crazy looking.

I''m hoping that someone can tell me a simpler coding
method. My other thought was maybe it''s possible
something to do with the SelectedRange? I thought maybe
there is a way to loop through selected range to see if
dayofweek for each weekend day fell inside that range but
I really don''t know how I would do that (if it''s even
possible)especially since dayofweek gives an integer while
selectedrange gives dates.



* "Sand" <an*******@discussions.microsoft.com> scripsit:

I have a monthCalender that I want users to be able to
select a range of dates (or a single date) then calculate
a value based on the number of days that person has
selected. The values are higher for the weekends so I
need to be able to figure out how many of the selected
days are weekdays versus weekends.

I already have code to tell me the number of days the
person has selected. I also understand how to get the
DayOfWeek. I tried to code an nested if statement that
would check the dayofweek, see how far away from the
weekend it is and then check that against the number of
days the user selected but it has become unwieldly and,
well, pretty crazy looking.

I''m hoping that someone can tell me a simpler coding
method. My other thought was maybe it''s possible
something to do with the SelectedRange? I thought maybe
there is a way to loop through selected range to see if
dayofweek for each weekend day fell inside that range but
I really don''t know how I would do that (if it''s even
possible)especially since dayofweek gives an integer while
selectedrange gives dates.



Post code!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


Hi Sand,

First, set up 2 monthcalendar controls - start and end. Then have the user
select the same date in both if only one day. Then have a look at the
datediff function to determine the date range.

HTH,

Bernie Yaeger

"Sand" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...

I have a monthCalender that I want users to be able to
select a range of dates (or a single date) then calculate
a value based on the number of days that person has
selected. The values are higher for the weekends so I
need to be able to figure out how many of the selected
days are weekdays versus weekends.

I already have code to tell me the number of days the
person has selected. I also understand how to get the
DayOfWeek. I tried to code an nested if statement that
would check the dayofweek, see how far away from the
weekend it is and then check that against the number of
days the user selected but it has become unwieldly and,
well, pretty crazy looking.

I''m hoping that someone can tell me a simpler coding
method. My other thought was maybe it''s possible
something to do with the SelectedRange? I thought maybe
there is a way to loop through selected range to see if
dayofweek for each weekend day fell inside that range but
I really don''t know how I would do that (if it''s even
possible)especially since dayofweek gives an integer while
selectedrange gives dates.

Oy!

Any help would be greatly appreciated.

Thank you.



这篇关于的MonthCalendar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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