SelectionRange.Start 속성
선택 영역 범위의 시작 날짜 및 시간을 가져오거나 설정합니다.
네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)
구문
‘선언
Public Property Start As DateTime
‘사용 방법
Dim instance As SelectionRange
Dim value As DateTime
value = instance.Start
instance.Start = value
public DateTime Start { get; set; }
public:
property DateTime Start {
DateTime get ();
void set (DateTime value);
}
/** @property */
public DateTime get_Start ()
/** @property */
public void set_Start (DateTime value)
public function get Start () : DateTime
public function set Start (value : DateTime)
속성 값
범위의 시작 DateTime 값입니다.
예제
다음 예제에서는 SelectionRange 개체를 만들고 Start 및 End 속성을 설정하며 SelectionRange 개체를 MonthCalendar 컨트롤의 SelectionRange 속성에 할당합니다. DateChanged 이벤트가 발생하면 텍스트 상자에 Start 및 End 속성 값이 표시됩니다. 이 예제에서는 두 개의 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
플랫폼
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
.NET Compact Framework
2.0에서 지원
참고 항목
참조
SelectionRange 클래스
SelectionRange 멤버
System.Windows.Forms 네임스페이스
SelectionRange.End 속성