SelectedDatesCollection.SelectRange メソッドとは? わかりやすく解説

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

SelectedDatesCollection.SelectRange メソッド

指定した日付範囲SelectedDatesCollection コレクション追加します

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

Public Sub SelectRange ( _
    fromDate As DateTime, _
    toDate As DateTime _
)
Dim instance As SelectedDatesCollection
Dim fromDate As DateTime
Dim toDate As DateTime

instance.SelectRange(fromDate, toDate)
public void SelectRange (
    DateTime fromDate,
    DateTime toDate
)
public:
void SelectRange (
    DateTime fromDate, 
    DateTime toDate
)
public void SelectRange (
    DateTime fromDate, 
    DateTime toDate
)
public function SelectRange (
    fromDate : DateTime, 
    toDate : DateTime
)

パラメータ

fromDate

SelectedDatesCollection に追加する最初日付指定する System.DateTime。

toDate

SelectedDatesCollection追加する最後の日付を指定する System.DateTime

解説解説
使用例使用例

プログラムによって SelectRange メソッド使用しCalendar コントロール連続した日付範囲選択する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<html>
<head>
 
   <script runat="server">

      Sub Page_Load(sender As Object,
 e As EventArgs)

         ' Initialize the VisibleDate property with today's date when
         ' the page is first loaded.
         If Not IsPostBack Then

            Calendar1.VisibleDate = Calendar1.TodaysDate

         End If

      End Sub
 
      Sub Button_Click(sender As Object,
 e As EventArgs) 
 
         ' This method demonstrates how to select a range of dates
         ' in the calendar. 
  
         ' Get the month and year of the date contained in the 
         ' VisibleDate property.
         Dim CurrentMonth As Integer
 = Calendar1.VisibleDate.Month
         Dim CurrentYear As Integer
 = Calendar1.VisibleDate.Year

         ' Set the start and end dates.
         Dim BeginDate As DateTime = New
 DateTime(CurrentYear, CurrentMonth, 1)
         Dim EndDate As DateTime = New
 DateTime(CurrentYear, CurrentMonth, 7)
 
         ' Clear any selected dates.
         Calendar1.SelectedDates.Clear() 
 
         ' Select the specified range of dates.
         Calendar1.SelectedDates.SelectRange(BeginDate, EndDate)
 
      End Sub
 
   </script>
 
</head>     
<body>
 
   <form runat="server">

      <h3>SelectedDatesCollection SelectRange Example </h3>

      Click the button to select all dates
 between the 1st and the 
      7th of the month.

      <br><br>
 
      <asp:Calendar ID="Calendar1"  
           SelectionMode="DayWeekMonth"
           runat="server" />
 
      <hr>
 
      <asp:Button id="SubmitButton"
           Text="Select the 1st to the 7th of the Month"
 
           OnClick="Button_Click"  
           runat="server"  /> 
       
      <br>
 
      <asp:Label id="Message" 
           runat="server" />
 
   </form>

</body>
</html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
 
   <script runat="server">

      void Page_Load(Object sender, EventArgs e)
      {

         // Initialize the VisibleDate property with today's date when
         // the page is first loaded.
         if(!IsPostBack)
         {

            Calendar1.VisibleDate = Calendar1.TodaysDate;

         }

      }
 
      void Button_Click(Object sender, EventArgs e) 
      {
 
         // This method demonstrates how to select a range of dates
 
         // in the calendar. 
  
         // Get the month and year of the date contained in the 
         // VisibleDate property.
         int CurrentMonth = Calendar1.VisibleDate.Month;
         int CurrentYear = Calendar1.VisibleDate.Year;

         // Set the start and end dates.
         DateTime BeginDate = new DateTime(CurrentYear, CurrentMonth,
 1);
         DateTime EndDate = new DateTime(CurrentYear, CurrentMonth,
 7);
 
         // Clear any selected dates.
         Calendar1.SelectedDates.Clear(); 
 
         // Select the specified range of dates.
         Calendar1.SelectedDates.SelectRange(BeginDate, EndDate);
 
      }
 
   </script>
 
</head>     
<body>
 
   <form runat="server">

      <h3>SelectedDatesCollection SelectRange Example </h3>

      Click the button to select all dates between the 1st and the
      7th of the month.

      <br><br>
 
      <asp:Calendar ID="Calendar1"  
           SelectionMode="DayWeekMonth"
           runat="server" />
 
      <hr>
 
      <asp:Button id="SubmitButton"
           Text="Select the 1st to the 7th of the Month" 
           OnClick="Button_Click"  
           runat="server"  /> 
       
      <br>
 
      <asp:Label id="Message" 
           runat="server" />
 
   </form>

</body>
</html>
 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SelectedDatesCollection クラス
SelectedDatesCollection メンバ
System.Web.UI.WebControls 名前空間
System.DateTime
Calendar クラス



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

辞書ショートカット

すべての辞書の索引

SelectedDatesCollection.SelectRange メソッドのお隣キーワード
検索ランキング

   

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



SelectedDatesCollection.SelectRange メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS