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

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

SelectedDatesCollection.Contains メソッド

指定した System.DateTime オブジェクトSelectedDatesCollection コレクション格納されているかどうかを示す値を返します

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

Dim instance As SelectedDatesCollection
Dim date As DateTime
Dim returnValue As Boolean

returnValue = instance.Contains(date)
public bool Contains (
    DateTime date
)
public:
bool Contains (
    DateTime date
)

パラメータ

date

SelectedDatesCollection で検索する System.DateTime。

戻り値
指定した System.DateTimeSelectedDatesCollection含まれている場合trueそれ以外場合false

解説解説

このメソッド使用して指定した System.DateTime オブジェクトSelectedDatesCollection コレクション含まれているかどうか確認します

使用例使用例

Contains メソッド使用して指定した System.DateTime オブジェクトSelectedDatesCollection コレクション含まれているかどうか確認する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<html>
 <head>
 
    <script language="VB" runat="server">

        Sub Button_Click(sender As Object,
 e As EventArgs)
            
            Dim current_month As Integer
 = Calendar1.VisibleDate.Month
            Dim current_year As Integer
 = Calendar1.VisibleDate.Year
            
            Calendar1.VisibleDate = Calendar1.TodaysDate
            
            Dim theDate As New
 DateTime(current_year, current_month, 15)
            
            If Calendar1.SelectedDates.Contains(theDate) Then
                Label1.Text = "Yes, you selected the 15th!!"
            Else
                Label1.Text = "No, you didn't select the 15th!!"
            End If 
        End Sub
 
    </script>
 
 </head>     
 <body>
 
    <form runat="server">
 
       <asp:Calendar ID="Calendar1" runat="server"
  
            SelectionMode="DayWeekMonth"/>
 
       <hr>
 
       Select dates on the Calendar and
 click the button below <br>
       to validate that the 15th on the month
 was selected <br><br> 
 
       <asp:Button id="Button1"
            text="Validate the 15th" 
            OnClick="Button_Click"  
            runat=server  /> <br><br>
 
       <asp:Label id="Label1" runat=server />
 
    </form>
 </body>
 </html>
    
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>
 <head>
 
    <script language="C#" runat="server">
 
       void Button_Click(Object sender, EventArgs e) 
       {
   
          int current_month = Calendar1.VisibleDate.Month;
          int current_year = Calendar1.VisibleDate.Year;
           
          Calendar1.VisibleDate = Calendar1.TodaysDate;
 
          DateTime date = new DateTime(current_year, current_month,
 15);
 
          if (Calendar1.SelectedDates.Contains(date)) 
             Label1.Text = "Yes, you selected the 15th!!";
          else
             Label1.Text = "No, you didn't select the 15th!!";
             
       }
 
    </script>
 
 </head>     
 <body>
 
    <form runat="server">
 
       <asp:Calendar ID="Calendar1" runat="server"  
            SelectionMode="DayWeekMonth"/>
 
       <hr>
 
       Select dates on the Calendar and click the button below <br>
       to validate that the 15th on the month was selected <br><br> 
 
       <asp:Button id="Button1"
            text="Validate the 15th" 
            OnClick="Button_Click"  
            runat=server  /> <br><br>
 
       <asp:Label id="Label1" runat=server />
 
    </form>
 </body>
 </html>
    
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SelectedDatesCollection クラス
SelectedDatesCollection メンバ
System.Web.UI.WebControls 名前空間
System.DateTime
Calendar.SelectedDates プロパティ
Calendar クラス



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS