SelectionRangeとは? わかりやすく解説

SelectionRange クラス

月間予定表コントロール選択されている日付範囲表します

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

Public NotInheritable Class
 SelectionRange
Dim instance As SelectionRange
public sealed class SelectionRange
public ref class SelectionRange sealed
public final class SelectionRange
public final class SelectionRange
解説解説
使用例使用例

Buttonクリックされたときに、2 つTextBox コントロール入力され2 つ日付基づいてMonthCalendar コントロールSelectionRange プロパティ設定する例を次に示します。このコードは、MonthCalendar コントロール新しインスタンス2 つTextBox コントロール、および ButtonForm 上に作成されていることを前提にしています。テキスト ボックス入力されText検証するためのコード追加し入力され日付が有効かどうか確認できます

Private Sub button1_Click(sender As
 Object, e As EventArgs)
   ' Set the SelectionRange with start and end dates from text boxes.
   Try
      monthCalendar1.SelectionRange = New SelectionRange( _
        DateTime.Parse(textBox1.Text), _
        DateTime.Parse(textBox2.Text))
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
End Sub
private void button1_Click(object sender,
                           EventArgs e)
{
   // Set the SelectionRange with start and end dates from text boxes.
   try
   {
      monthCalendar1.SelectionRange = new SelectionRange(
        DateTime.Parse(textBox1.Text),
        DateTime.Parse(textBox2.Text));
   }
   catch(Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}
private:
   void button1_Click( Object^ sender, EventArgs^ e )
   {
      // Set the SelectionRange with start and end dates from text boxes.
      try
      {
         monthCalendar1->SelectionRange = gcnew SelectionRange(
            DateTime::Parse( textBox1->Text ),
            DateTime::Parse( textBox2->Text ) );
      }
      catch ( Exception^ ex ) 
      {
         MessageBox::Show( ex->Message );
      }
   }
private void button1_Click(Object sender, EventArgs
 e)
{
    // Set the SelectionRange with start and end dates from text boxes.
    try {
        monthCalendar1.set_SelectionRange(
        new SelectionRange(DateTime.Parse(textBox1.get_Text()),
 
            DateTime.Parse(textBox2.get_Text())));
    }
    catch (System.Exception ex) {
        MessageBox.Show(ex.get_Message());
    }
} //button1_Click
継承階層継承階層
System.Object
  System.Windows.Forms.SelectionRange
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SelectionRange コンストラクタ ()

SelectionRange クラス新しインスタンス初期化します。

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

Dim instance As New SelectionRange
public SelectionRange ()
public:
SelectionRange ()
public SelectionRange ()
public function SelectionRange ()
解説解説

このコンストラクタ使用すると、Start および End の値が null 参照 (Visual Basic では Nothing) に設定されます。

使用例使用例

SelectionRange オブジェクト作成し、その Start プロパティEnd プロパティ設定しSelectionRange オブジェクトを MonthCalendar コントロールの SelectionRange プロパティ割り当てる例を次に示します。DateChanged イベント発生すると、Start プロパティおよび End プロパティの値がテキスト ボックス表示されます。この例は、2 つTextBox コントロールButton コントロール、および MonthCalendar コントロール配置されForm があることを前提にしています。

Private Sub button1_Click(sender As
 Object, _
  e As EventArgs) Handles button1.Click
   ' Create a SelectionRange object and set its Start and End properties.
   Dim sr As New SelectionRange()
   sr.Start = DateTime.Parse(Me.textBox1.Text)
   sr.End = DateTime.Parse(Me.textBox2.Text)
   ' Assign the SelectionRange object to the
   ' SelectionRange property of the MonthCalendar control. 
   Me.monthCalendar1.SelectionRange = sr
End Sub 


Private Sub monthCalendar1_DateChanged(sender
 As Object, _
  e As DateRangeEventArgs) Handles monthCalendar1.DateChanged
   ' Display the Start and End property values of
   ' the SelectionRange object in the text boxes. 
   Me.textBox1.Text = monthCalendar1.SelectionRange.Start.Date.ToShortDateString()
   Me.textBox2.Text = monthCalendar1.SelectionRange.End.Date.ToShortDateString()
End Sub
private void button1_Click(object sender, System.EventArgs
 e)
{
   // Create a SelectionRange object and set its Start and End properties.
   SelectionRange sr = new SelectionRange();
   sr.Start = DateTime.Parse(this.textBox1.Text);
   sr.End = DateTime.Parse(this.textBox2.Text);
   /* Assign the SelectionRange object to the 
      SelectionRange property of the MonthCalendar control. */
   this.monthCalendar1.SelectionRange = sr;
}

private void monthCalendar1_DateChanged(object
 sender, DateRangeEventArgs e)
{
   /* Display the Start and End property values of 
      the SelectionRange object in the text boxes. */
   this.textBox1.Text = 
     monthCalendar1.SelectionRange.Start.Date.ToShortDateString();
   this.textBox2.Text = 
     monthCalendar1.SelectionRange.End.Date.ToShortDateString();
}
private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      // Create a SelectionRange object and set its Start and End properties.
      SelectionRange^ sr = gcnew SelectionRange;
      sr->Start = DateTime::Parse( this->textBox1->Text
 );
      sr->End = DateTime::Parse( this->textBox2->Text
 );
      
      /* Assign the SelectionRange object to the
            SelectionRange property of the MonthCalendar control. */
      this->monthCalendar1->SelectionRange = sr;
   }

   void monthCalendar1_DateChanged( Object^ /*sender*/, DateRangeEventArgs^
 /*e*/ )
   {
      /* Display the Start and End property values of
            the SelectionRange object in the text boxes. */
      this->textBox1->Text = monthCalendar1->SelectionRange->Start.Date.ToShortDateString();
      this->textBox2->Text = monthCalendar1->SelectionRange->End.Date.ToShortDateString();
   }
private void button1_Click(Object sender, System.EventArgs
 e)
{
    // Create a SelectionRange object and set its Start and End properties.
    SelectionRange sr = new SelectionRange();
    sr.set_Start(DateTime.Parse(this.textBox1.get_Text()));
    sr.set_End(DateTime.Parse(this.textBox2.get_Text()));

    /* Assign the SelectionRange object to the 
       SelectionRange property of the MonthCalendar control. */
    this.monthCalendar1.set_SelectionRange(sr);
} //button1_Click

private void monthCalendar1_DateChanged(Object
 sender, DateRangeEventArgs e)
{
    /* Display the Start and End property values of 
       the SelectionRange object in the text boxes. */
    this.textBox1.set_Text(monthCalendar1.get_SelectionRange().get_Start().
        get_Date().ToShortDateString());
    this.textBox2.set_Text(monthCalendar1.get_SelectionRange().get_End().
        get_Date().ToShortDateString());
} //monthCalendar1_DateChanged
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SelectionRange コンストラクタ (SelectionRange)

指定した選択範囲使用してSelectionRange クラス新しインスタンス初期化します。

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

Public Sub New ( _
    range As SelectionRange _
)
Dim range As SelectionRange

Dim instance As New SelectionRange(range)
public SelectionRange (
    SelectionRange range
)
public:
SelectionRange (
    SelectionRange^ range
)
public SelectionRange (
    SelectionRange range
)
public function SelectionRange (
    range : SelectionRange
)

パラメータ

range

既存の SelectionRange。

解説解説
使用例使用例

SelectionRange オブジェクト作成し、その Start プロパティEnd プロパティ設定しSelectionRange オブジェクトを MonthCalendar コントロールの SelectionRange プロパティ割り当てる例を次に示します。DateChanged イベント発生すると、Start プロパティおよび End プロパティの値がテキスト ボックス表示されます。この例は、2 つTextBox コントロールButton コントロール、および MonthCalendar コントロール配置されForm があることを前提にしています。

Private Sub button1_Click(sender As
 Object, _
  e As EventArgs) Handles button1.Click
   ' Create a SelectionRange object and set its Start and End properties.
   Dim sr As New SelectionRange()
   sr.Start = DateTime.Parse(Me.textBox1.Text)
   sr.End = DateTime.Parse(Me.textBox2.Text)
   ' Assign the SelectionRange object to the
   ' SelectionRange property of the MonthCalendar control. 
   Me.monthCalendar1.SelectionRange = sr
End Sub 


Private Sub monthCalendar1_DateChanged(sender
 As Object, _
  e As DateRangeEventArgs) Handles monthCalendar1.DateChanged
   ' Display the Start and End property values of
   ' the SelectionRange object in the text boxes. 
   Me.textBox1.Text = monthCalendar1.SelectionRange.Start.Date.ToShortDateString()
   Me.textBox2.Text = monthCalendar1.SelectionRange.End.Date.ToShortDateString()
End Sub
private void button1_Click(object sender, System.EventArgs
 e)
{
   // Create a SelectionRange object and set its Start and End properties.
   SelectionRange sr = new SelectionRange();
   sr.Start = DateTime.Parse(this.textBox1.Text);
   sr.End = DateTime.Parse(this.textBox2.Text);
   /* Assign the SelectionRange object to the 
      SelectionRange property of the MonthCalendar control. */
   this.monthCalendar1.SelectionRange = sr;
}

private void monthCalendar1_DateChanged(object
 sender, DateRangeEventArgs e)
{
   /* Display the Start and End property values of 
      the SelectionRange object in the text boxes. */
   this.textBox1.Text = 
     monthCalendar1.SelectionRange.Start.Date.ToShortDateString();
   this.textBox2.Text = 
     monthCalendar1.SelectionRange.End.Date.ToShortDateString();
}
private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      // Create a SelectionRange object and set its Start and End properties.
      SelectionRange^ sr = gcnew SelectionRange;
      sr->Start = DateTime::Parse( this->textBox1->Text
 );
      sr->End = DateTime::Parse( this->textBox2->Text
 );
      
      /* Assign the SelectionRange object to the
            SelectionRange property of the MonthCalendar control. */
      this->monthCalendar1->SelectionRange = sr;
   }

   void monthCalendar1_DateChanged( Object^ /*sender*/, DateRangeEventArgs^
 /*e*/ )
   {
      /* Display the Start and End property values of
            the SelectionRange object in the text boxes. */
      this->textBox1->Text = monthCalendar1->SelectionRange->Start.Date.ToShortDateString();
      this->textBox2->Text = monthCalendar1->SelectionRange->End.Date.ToShortDateString();
   }
private void button1_Click(Object sender, System.EventArgs
 e)
{
    // Create a SelectionRange object and set its Start and End properties.
    SelectionRange sr = new SelectionRange();
    sr.set_Start(DateTime.Parse(this.textBox1.get_Text()));
    sr.set_End(DateTime.Parse(this.textBox2.get_Text()));

    /* Assign the SelectionRange object to the 
       SelectionRange property of the MonthCalendar control. */
    this.monthCalendar1.set_SelectionRange(sr);
} //button1_Click

private void monthCalendar1_DateChanged(Object
 sender, DateRangeEventArgs e)
{
    /* Display the Start and End property values of 
       the SelectionRange object in the text boxes. */
    this.textBox1.set_Text(monthCalendar1.get_SelectionRange().get_Start().
        get_Date().ToShortDateString());
    this.textBox2.set_Text(monthCalendar1.get_SelectionRange().get_End().
        get_Date().ToShortDateString());
} //monthCalendar1_DateChanged
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SelectionRange コンストラクタ


SelectionRange コンストラクタ (DateTime, DateTime)

指定した開始日および終了日を使用してSelectionRange クラス新しインスタンス初期化します。

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

public SelectionRange (
    DateTime lower,
    DateTime upper
)
public:
SelectionRange (
    DateTime lower, 
    DateTime upper
)
public SelectionRange (
    DateTime lower, 
    DateTime upper
)

パラメータ

lower

SelectionRange の開始日。

upper

SelectionRange終了日。

解説解説
使用例使用例

Buttonクリックされたときに、2 つTextBox コントロール入力され2 つ日付基づいて、MonthCalendar コントロールSelectionRange プロパティ設定する例を次に示します。このコードは、MonthCalendar コントロール新しインスタンス2 つTextBox コントロール、および ButtonForm 上に作成されていることを前提にしています。テキスト ボックス入力されText検証するためのコード追加し入力され日付が有効かどうか確認できます

Private Sub button1_Click(sender As
 Object, e As EventArgs)
   ' Set the SelectionRange with start and end dates from text boxes.
   Try
      monthCalendar1.SelectionRange = New SelectionRange( _
        DateTime.Parse(textBox1.Text), _
        DateTime.Parse(textBox2.Text))
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
End Sub
private void button1_Click(object sender,
                           EventArgs e)
{
   // Set the SelectionRange with start and end dates from text boxes.
   try
   {
      monthCalendar1.SelectionRange = new SelectionRange(
        DateTime.Parse(textBox1.Text),
        DateTime.Parse(textBox2.Text));
   }
   catch(Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}
private:
   void button1_Click( Object^ sender, EventArgs^ e )
   {
      // Set the SelectionRange with start and end dates from text boxes.
      try
      {
         monthCalendar1->SelectionRange = gcnew SelectionRange(
            DateTime::Parse( textBox1->Text ),
            DateTime::Parse( textBox2->Text ) );
      }
      catch ( Exception^ ex ) 
      {
         MessageBox::Show( ex->Message );
      }
   }
private void button1_Click(Object sender, EventArgs
 e)
{
    // Set the SelectionRange with start and end dates from text boxes.
    try {
        monthCalendar1.set_SelectionRange(
        new SelectionRange(DateTime.Parse(textBox1.get_Text()),
 
            DateTime.Parse(textBox2.get_Text())));
    }
    catch (System.Exception ex) {
        MessageBox.Show(ex.get_Message());
    }
} //button1_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SelectionRange プロパティ


SelectionRange メソッド


SelectionRange メンバ

月間予定表コントロール選択されている日付範囲表します

SelectionRange データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SelectionRange クラス
System.Windows.Forms 名前空間
DateTimePicker クラス
DateTime


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

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

辞書ショートカット

すべての辞書の索引

「SelectionRange」の関連用語

SelectionRangeのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS