怎样利用VB编码设置一个日历,可以让2月显示28天或29天
PrivateSubForm_Load()Dimi,jAsIntegerCombo日期(0).Text=Year(Date)Combo日期(1).Text=Month(D...
Private Sub Form_Load()
Dim i, j As Integer
Combo日期(0).Text = Year(Date)
Combo日期(1).Text = Month(Date)
Combo日期(2).Text = Day(Date)
Label当前日期.Caption = "当前日期:" & Year(Date) & " 年 " & Month(Date) & " 月 " & Day(Date) & " 日"
For i = 2010 To 2020
Combo日期(0).AddItem i
Next i
For i = 1 To 12
Combo日期(1).AddItem i
Next i
Select Case Combo日期(1).Text
Case Combo日期(1).Text = 1, 3, 5, 7, 8, 10, 12
For j = 1 To 31
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 4, 6, 9, 11
For j = 1 To 30
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 2
For j = 1 To 29
Combo日期(2).AddItem j
Next j
End Select
哪里错了?为什么2月最后不显示29天 展开
Dim i, j As Integer
Combo日期(0).Text = Year(Date)
Combo日期(1).Text = Month(Date)
Combo日期(2).Text = Day(Date)
Label当前日期.Caption = "当前日期:" & Year(Date) & " 年 " & Month(Date) & " 月 " & Day(Date) & " 日"
For i = 2010 To 2020
Combo日期(0).AddItem i
Next i
For i = 1 To 12
Combo日期(1).AddItem i
Next i
Select Case Combo日期(1).Text
Case Combo日期(1).Text = 1, 3, 5, 7, 8, 10, 12
For j = 1 To 31
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 4, 6, 9, 11
For j = 1 To 30
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 2
For j = 1 To 29
Combo日期(2).AddItem j
Next j
End Select
哪里错了?为什么2月最后不显示29天 展开
4个回答
展开全部
Private Sub Combo日期_click(Index As Integer)
If Index = 1 Then
Combo日期(2).Clear
Select Case Combo日期(1).Text
Case 1, 3, 5, 7, 8, 10, 12
For j = 1 To 31
Combo日期(2).AddItem j
Next j
Case 4, 6, 9, 11
For j = 1 To 30
Combo日期(2).AddItem j
Next j
Case 2
For j = 1 To 29
Combo日期(2).AddItem j
Next j
End Select
End If
Combo日期(2).Text = Combo日期(2).List(0)
End Sub
Private Sub Form_Load()
Dim i, j As Integer
Combo日期(0).Text = Year(Date)
Combo日期(1).Text = Month(Date)
Combo日期(2).Text = Day(Date)
Label当前日期.Caption = "当前日期:" & Year(Date) & " 年 " & Month(Date) & " 月 " & Day(Date) & " 日"
For i = 2010 To 2020
Combo日期(0).AddItem i
Next i
For i = 1 To 12
Combo日期(1).AddItem i
Next i
Select Case Combo日期(1).Text
Case Combo日期(1).Text = 1, 3, 5, 7, 8, 10, 12
For j = 1 To 31
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 4, 6, 9, 11
For j = 1 To 30
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 2
For j = 1 To 29
Combo日期(2).AddItem j
Next j
End Select
End Sub
If Index = 1 Then
Combo日期(2).Clear
Select Case Combo日期(1).Text
Case 1, 3, 5, 7, 8, 10, 12
For j = 1 To 31
Combo日期(2).AddItem j
Next j
Case 4, 6, 9, 11
For j = 1 To 30
Combo日期(2).AddItem j
Next j
Case 2
For j = 1 To 29
Combo日期(2).AddItem j
Next j
End Select
End If
Combo日期(2).Text = Combo日期(2).List(0)
End Sub
Private Sub Form_Load()
Dim i, j As Integer
Combo日期(0).Text = Year(Date)
Combo日期(1).Text = Month(Date)
Combo日期(2).Text = Day(Date)
Label当前日期.Caption = "当前日期:" & Year(Date) & " 年 " & Month(Date) & " 月 " & Day(Date) & " 日"
For i = 2010 To 2020
Combo日期(0).AddItem i
Next i
For i = 1 To 12
Combo日期(1).AddItem i
Next i
Select Case Combo日期(1).Text
Case Combo日期(1).Text = 1, 3, 5, 7, 8, 10, 12
For j = 1 To 31
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 4, 6, 9, 11
For j = 1 To 30
Combo日期(2).AddItem j
Next j
Case Combo日期(1).Text = 2
For j = 1 To 29
Combo日期(2).AddItem j
Next j
End Select
End Sub
展开全部
直接用DTPicker控件就可以了呀,你可以通过year(),month()等函数来提取相应的年月日.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-05-06
展开全部
可以要人民币!!!
另外,团IDC网上有许多产品团购,便宜有口碑
另外,团IDC网上有许多产品团购,便宜有口碑
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询