设计一个VB程序内容:

来源:百度知道 编辑:UC知道 时间:2024/07/07 15:48:08
设计一个VB程序内容:3个text框,分别是text1、text2、text3命令按钮名为command1.要求编程实现:在文本框TEXT1中输入4位年份数据、在文本框text2中输入月份数据,然后单击命令按钮command1,即可在文本框text3中显示该月份的天数。

Private Sub Command1_Click()

A = (Text1.Text) Mod 4
B = (Text1.Text) Mod 100
C = (Text1.Text) Mod 400

If Text2.Text = 2 Then
If (C = 0 Or (A = 0 And B <> 0)) Then
Text3.Text = 29
Else
Text3.Text = 28
End If
End If

Select Case (Text2.Text)
Case 1, 3, 5, 7, 8, 10, 12
Text3.Text = 31
Case 4, 6, 9, 11
Text3.Text = 30
End Select
End Sub

没用VB测试过 应该可用