Controls [vb.net] DateTimePicker 전월, 전주, 어제, 오늘, 금주 설정하기
페이지 정보
본문
Private Sub cmd_d_x_Click(sender As Object, e As EventArgs) Handles cmd_d_5.Click, cmd_d_4.Click, cmd_d_3.Click, cmd_d_2.Click, cmd_d_1.Click
Dim nm As String = sender.Name
Dim idx As Integer = nm.Split("_").Last
Select Case idx
Case 1 '// 전월
DTP_0_1.Value = DateSerial(Year(Now), Month(Now) - 1, 1)
DTP_0_2.Value = DateSerial(Year(Now), Month(Now), 0)
Case 2 '// 전주
DTP_0_2.Value = Now.Date.AddDays(-Weekday(Now, FirstDayOfWeek.Sunday))
DTP_0_1.Value = DTP_0_2.Value.AddDays(-6)
Case 3 '// 어제
DTP_0_1.Value = Now.Date.AddDays(-1)
DTP_0_2.Value = DTP_0_1.Value
Case 4 '// 오늘
DTP_0_1.Value = Now.Date
DTP_0_2.Value = DTP_0_1.Value
Case 5 '// 금주
DTP_0_1.Value = Now.Date.AddDays(-Weekday(Now, FirstDayOfWeek.Monday))
DTP_0_2.Value = Now.Date
Case 6
End Select
End Sub
- 이전글[vb.net] Round Button 23.06.07
- 다음글[vb.net] JSON Example 23.04.09
댓글목록
등록된 댓글이 없습니다.