ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[vb 2010]§PÂ_DateTimePicker®É¶¡

[vb 2010]§PÂ_DateTimePicker®É¶¡

§Ú·Q¦bwindows formµ{¦¡©³¤U¥Î¤@­ÓDateTimePicker©M¤@­ÓButton¡A¦pªG¤é´Á­è¦n¬P´Á¤@®É¡A§Ú«ö¤UButton´N·|Åã¥Ü"¶g¤@¤£¶}À]"¿ù»~°T®§®Ø
µ{¦¡½X¦p¤U¡G
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If DayOfWeek.Monday = True Then
            MessageBox.Show("¶g¤@¤£¶}À]", "¤é´Á¿ù»~", MessageBoxButtons.OK)
        End If
    End Sub
End Class
¦ý§Ú°õ¦æ´ú¸ÕÂI¿ïDateTimePicker¸Ìªº¤é´Á¬P´Á¤@¡A¦A«öbutton«o¨S¦³·Ó§Úªº·Qªk°µ¡A¤£ª¾­þ¸Ì¿ù¤F¡A§Æ±æ¦³«e½ú«üÂI¤@¤UÁÂÁÂ

§Ú·Q¦bwindows formµ{¦¡©³¤U¥Î¤@­ÓDateTimePicker©M¤@­ÓButton¡A¦pªG¤é´Á­è¦n¬P´Á¤@®É¡A§Ú«ö¤UButton´N·|Åã ...
edchen70 µoªí©ó 2015-11-11 20:21



    §Aªºµ{¦¡  ¨S¦³¥ô¦ó DateTimePickerªºÃö³s©Ê..
    ¥H¤U°Æµ{¦¡¬O§Ú§Ë¨â­ÓDateTimePicker ­É¦¹¤ñ¹ï ¤é´Á¶¡¶Z..
  1.     Sub wd12s()  '¤é´Á§PÂ_°Æµ{¦¡
  2.         Dim d1 As Date = DateTimePicker1.Value
  3.         Dim d2 As Date = DateTimePicker2.Value
  4.         Dim wd1 As String = DateTimePicker1.Value.DayOfWeek
  5.         Dim wd2 As String = DateTimePicker2.Value.DayOfWeek
  6.         Select Case wd1
  7.             Case 0 : wd1 = "¤é" : Case 1 : wd1 = "¤@" : Case 2 : wd1 = "¤G" : Case 3 : wd1 = "¤T" : Case 4 : wd1 = "¥|"
  8.             Case 5 : wd1 = "¤­" : Case 6 : wd1 = "¤»"
  9.         End Select

  10.         Select Case wd2
  11.             Case 0 : wd2 = "¤é" : Case 1 : wd2 = "¤@" : Case 2 : wd2 = "¤G" : Case 3 : wd2 = "¤T" : Case 4 : wd2 = "¥|"
  12.             Case 5 : wd2 = "¤­" : Case 6 : wd2 = "¤»"
  13.         End Select

  14.         If d2 = d1 Then
  15.             Label14.Text = "( " & wd1 & " )" & "  ~  "
  16.             Label15.Text = "( " & wd2 & " )" & "¡A ·í¤Ñ"
  17.         Else
  18.             Label14.Text = "( " & wd1 & " )" & "  ~  "
  19.             Label15.Text = "( " & wd2 & " )" & "¡A¦@ " & DateDiff(DateInterval.Day, d1, d2) + 1 & "¤Ñ " & DateDiff(DateInterval.Day, d1, d2) & " ©]"
  20.         End If
  21.     End Sub
½Æ»s¥N½X
¦pªG§A¯uªº­n¥Îbutton§PÂ_ªº¸Ü
  1. ublic Class Form1

  2.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.       call wd12s
  4.         If  wd1="¤@"  Then msgbox "¶g¤@¤£¶}À]"
  5.     End Sub
  6. End Class
½Æ»s¥N½X

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

        ÀR«ä¦Û¦b : ¥Ç¿ù¥XÄb®¬¤ß¡A¤~¯à²M²bµL·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD