SelectedDatesCollection クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SelectedDatesCollection クラスの意味・解説 

SelectedDatesCollection クラス

Calendar コントロール選択されている日付を表す System.DateTime オブジェクトコレクションカプセル化ます。このクラス継承できません。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public NotInheritable Class
 SelectedDatesCollection
    Implements ICollection, IEnumerable
Dim instance As SelectedDatesCollection
public sealed class SelectedDatesCollection
 : ICollection, IEnumerable
public ref class SelectedDatesCollection sealed
 : ICollection, IEnumerable
public final class SelectedDatesCollection
 implements ICollection, IEnumerable
public final class SelectedDatesCollection
 implements ICollection, IEnumerable
解説解説
使用例使用例

プログラムによって SelectedDatesCollection クラス使用しCalendar コントロール日付選択する方法次のコード例示します

<%@ Page Language="VB"%>
 
<script runat="server">
 
  Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)
 
    DisplayCalendar.VisibleDate = DisplayCalendar.TodaysDate
    
  End Sub

  Sub SelectButton_Click(ByVal sender As
 Object, ByVal e As EventArgs)

    Dim current_day As Integer
 = DisplayCalendar.VisibleDate.Day
    Dim current_month As Integer
 = DisplayCalendar.VisibleDate.Month
    Dim current_year As Integer
 = DisplayCalendar.VisibleDate.Year

    DisplayCalendar.SelectedDates.Clear()
   
    ' Iterate through the current month and add all Wednesdays to the
 
    ' SelectedDates collection of the Calendar control.
    Dim i As Integer
    For i = 1 To System.DateTime.DaysInMonth(current_year,
 current_month)
    
      Dim currentDate As New
 DateTime(current_year, current_month, i)
      If currentDate.DayOfWeek = DayOfWeek.Wednesday Then
       
        DisplayCalendar.SelectedDates.Add(currentDate)
        
      End If
      
    Next

    MessageLabel.Text = "Selection Count = " + DisplayCalendar.SelectedDates.Count.ToString()
 
  End Sub

  Sub DisplayCalendar_SelectionChanged(ByVal
 sender As Object, ByVal
 e As EventArgs)
  
    MessageLabel.Text = "Selection Count = " &
 DisplayCalendar.SelectedDates.Count.ToString()
  
  End Sub
 
</script> 
 
<html>
  <body>
    <form runat="server">
 
      <asp:calendar id="DisplayCalendar" runat="server"
  
        selectionmode="DayWeekMonth" 
        onselectionchanged="DisplayCalendar_SelectionChanged"
 />
 
      <hr>
 
      <asp:button id="SelectButton"
        text="Select All Weds in Month" 
        onclick="SelectButton_Click"  
        runat=server/> 
        
      <br/>
 
      <asp:label id="MessageLabel" 
        runat=server />
 
    </form>
  </body>
</html>
   
<%@ Page Language="C#"%>
 
<script runat="server">
 
  void Page_Load(Object sender, EventArgs e) 
  {
    DisplayCalendar.VisibleDate = DisplayCalendar.TodaysDate;
  }

  void SelectButton_Click(Object sender, EventArgs e) 
  {

    int current_day = DisplayCalendar.VisibleDate.Day;
    int current_month = DisplayCalendar.VisibleDate.Month;
    int current_year = DisplayCalendar.VisibleDate.Year;

    DisplayCalendar.SelectedDates.Clear();
   
    // Iterate through the current month and add all Wednesdays to the
 
    // SelectedDates collection of the Calendar control.
    for (int i = 1; i <= System.DateTime.DaysInMonth(current_year,
 current_month); i++)
    {
       DateTime currentDate = new DateTime(current_year, current_month,
 i);
       if (currentDate.DayOfWeek == DayOfWeek.Wednesday)
       {
         DisplayCalendar.SelectedDates.Add(currentDate);
       }
    }

     MessageLabel.Text = "Selection Count = " + DisplayCalendar.SelectedDates.Count.ToString();
 
  }

  void DisplayCalendar_SelectionChanged(Object sender, EventArgs
 e) 
  {
    MessageLabel.Text = "Selection Count = " + DisplayCalendar.SelectedDates.Count.ToString();
  }
 
</script> 
 
<html>
  <body>
    <form runat="server">
 
      <asp:calendar id="DisplayCalendar" runat="server"  
        selectionmode="DayWeekMonth" 
        onselectionchanged="DisplayCalendar_SelectionChanged" />
 
      <hr>
 
      <asp:button id="SelectButton"
        text="Select All Weds in Month" 
        onclick="SelectButton_Click"  
        runat=server/> 
        
      <br/>
 
      <asp:label id="MessageLabel" 
        runat=server />
 
    </form>
  </body>
</html>
   
継承階層継承階層
System.Object
  System.Web.UI.WebControls.SelectedDatesCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SelectedDatesCollection メンバ
System.Web.UI.WebControls 名前空間
Calendar クラス
Calendar.SelectedDates プロパティ
System.DateTime



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

辞書ショートカット

すべての辞書の索引

「SelectedDatesCollection クラス」の関連用語

SelectedDatesCollection クラスのお隣キーワード
検索ランキング

   

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



SelectedDatesCollection クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS