MonthCalendar.TodayDate プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MonthCalendar.TodayDate プロパティの意味・解説 

MonthCalendar.TodayDate プロパティ

今日の日付として MonthCalendar で使用される値を取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As MonthCalendar
Dim value As DateTime

value = instance.TodayDate

instance.TodayDate = value
public DateTime TodayDate { get; set;
 }
/** @property */
public DateTime get_TodayDate ()

/** @property */
public void set_TodayDate (DateTime value)

プロパティ
今日の日付を表す DateTime既定値は、現在のシステム日付です。

例外例外
例外種類条件

ArgumentOutOfRangeException

値が許容される日付最小値より小さい値です。

または

値が許容される日付最大値超えてます。

解説解説

既定では、TodayDate プロパティ現在のシステム日付返し、TodayDateSet プロパティfalse です。TodayDate プロパティ設定すると、TodayDateSet プロパティtrue設定されその時点から TodayDate プロパティによって返される値はユーザー設定値となります

使用例使用例

SelectionStart プロパティTodayDate プロパティおよび SelectionEnd プロパティ使用する方法次のコード例示します。この例を実行するには、次のコードMonthCalendar1 という名前の MonthCalendar コントロール配置されているフォーム貼り付けてフォームコンストラクタまたは Load イベント処理メソッドから ShowAWeeksVacationOneMonthFromToday メソッド呼び出します。

' Computes a week one month from today.
Private Sub ShowAWeeksVacationOneMonthFromToday()
     
    Dim today As Date =
 monthCalendar1.TodayDate
    Dim vacationMonth As Integer
 = today.Month + 1
    Dim vacationYear As Integer
 = today.Year
    If (today.Month = 12) Then
        vacationYear += 1
        vacationMonth = 1
    End If

    Me.monthCalendar1.SelectionStart = _
        New Date(vacationYear, vacationMonth,
 today.Day - 1)
    Me.monthCalendar1.SelectionEnd = _
        New Date(vacationYear, vacationMonth,
 today.Day + 6)
End Sub
// Computes a week one month from today.
private void ShowAWeeksVacationOneMonthFromToday()
{
    System.DateTime today = this.MonthCalendar1.TodayDate;
    int vacationMonth = today.Month + 1;
    int vacationYear = today.Year;

    if (today.Month == 12)
    {
        vacationMonth = 1;
        ++vacationYear;
    }

    // Select the week using SelectionStart and SelectionEnd.
    this.MonthCalendar1.SelectionStart = 
        new System.DateTime(today.Year, vacationMonth, today.Day-1);
    this.MonthCalendar1.SelectionEnd = 
        new System.DateTime(today.Year, vacationMonth, today.Day+6);
}
// Computes a week one month from today.
void ShowAWeeksVacationOneMonthFromToday()
{
   System::DateTime today = this->MonthCalendar1->TodayDate;
   int vacationMonth = today.Month + 1;
   int vacationYear = today.Year;

   if ( today.Month == 12 )
   {
      vacationMonth = 1;
      ++vacationYear;
   }
   
   // Select the week using SelectionStart and SelectionEnd.
   this->MonthCalendar1->SelectionStart =
      System::DateTime( today.Year, vacationMonth, today.Day - 1 );
   this->MonthCalendar1->SelectionEnd =
      System::DateTime( today.Year, vacationMonth, today.Day + 6 );
}
// Computes a week one month from today.
private void ShowAWeeksVacationOneMonthFromToday()
{
    System.DateTime today = this.monthCalendar1.get_TodayDate();
    int vacationMonth = 1;
    if (today.get_Month() < 12) {
        vacationMonth = today.get_Month() + 1;
    }
    // Select the week using SelectionStart and SelectionEnd.
    this.monthCalendar1.set_SelectionStart(
        new System.DateTime(today.get_Year(),
        vacationMonth, today.get_Day() - 1));
    this.monthCalendar1.set_SelectionEnd(
        new System.DateTime(today.get_Year(),
        vacationMonth, today.get_Day() + 6));
} //ShowAWeeksVacationOneMonthFromToday
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MonthCalendar クラス
MonthCalendar メンバ
System.Windows.Forms 名前空間
TodayDateSet
MonthCalendar.ShowToday プロパティ


このページでは「.NET Framework クラス ライブラリ リファレンス」からMonthCalendar.TodayDate プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からMonthCalendar.TodayDate プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からMonthCalendar.TodayDate プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「MonthCalendar.TodayDate プロパティ」の関連用語

MonthCalendar.TodayDate プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MonthCalendar.TodayDate プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS