自动判断日期的问题!
我想做一个从下拉列表框里选择年月日 自动判断当月有多少天的程序 但是功能实现不了 谁帮我看看是怎么回事啊combo2是年份 combo3是月份 combo4是日期
Private Sub Combo3_Change()
Dim month As Integer
Dim i As Integer
month = Val(Combo3.Text)
Select Case month
Case 1
For i = 1 To 31
Combo4.AddItem i, i - 1
Next i
Case 3
For i = 1 To 31
Combo4.AddItem i, i - 1
Next i
Case 5
For i = 1 To 31
Combo4.AddItem i, i - 1
Next i
Case 7
For i = 1 To 31
Combo4.AddItem i, i - 1
Next i
Case 8
For i = 1 To 31
Combo4.AddItem i, i - 1
Next i
Case 10
For i = 1 To 31
Combo4.AddItem i, i - 1
Next i
Case 12
For i = 1 To 31
Combo4.AddItem i, i - 1
Next i
Case 4
For i = 1 To 30
Combo4.AddItem i, i - 1
Next i
Case 6
For i = 1 To 30
Combo4.AddItem i, i - 1
Next i
Case 9
For i = 1 To 30
Combo4.AddItem i, i - 1
Next i
Case 11
For i = 1 To 30
Combo4.AddItem i, i - 1
Next i
Case 2
If Val(Combo2.Text) Mod 4 = 0 And Val(Combo2.Text) Mod 100 <> 0 Or Val(Combo2.Text) Mod 400 = 0 Then
For i = 1 To 29
Combo4.AddItem i, i - 1
Next
Else
For i = 1 To 28
Combo4.AddItem i, i - 1
Next
End If
End Select
End Sub