Function CountDay(month As Integer) As Integer
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
CountDay = 31
Case 4, 6, 9, 11
CountDay = 30
Case 2
CountDay = 29
End Select
End Function
Private Sub Command1_Click()
month = Text1.Text
CountDay = Text2.Text
End Sub
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
CountDay = 31
Case 4, 6, 9, 11
CountDay = 30
Case 2
CountDay = 29
End Select
End Function
Private Sub Command1_Click()
month = Text1.Text
CountDay = Text2.Text
End Sub
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
CountDay = 31
Case 4, 6, 9, 11
CountDay = 30
Case 2
CountDay = 29
End Select
End Function
Private Sub Command1_Click()
MsgBox CountDay(Text1.Text)
End Sub
month = Text1.Text
CountDay = Text2.Text
End Sub你这是什么啊~?~
MsgBox CountDay(cint(Text1.Text))
End Sub
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
CountDay = 31
Case 4, 6, 9, 11
CountDay = 30
Case 2
CountDay = iif(isdate("YEAR/2/29"),29,28) '
End Select
End Function
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
CountDay = 31
Case 4, 6, 9, 11
CountDay = 30
Case 2
CountDay = iif(isdate("YEAR/2/29"),29,28) '
End Select
End Function
Private Sub Command1_Click()
MsgBox CountDay(cint(Text1.Text))
End Sub
month = Text1.Text
CountDay = Text2.Text
End Sub
你这个怎么这样写?我想你是想根据text1中的月份,然后点击按钮,text2中显示天数吧
不要用month作为变量,它是保留字,另你的CountDay函数没判断闰年Private Sub Command1_Click()
dim mon as integer
mon = Text1.Text
Text2.Text=CountDay(mon)
End Sub
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
CountDay = 31
Case 4, 6, 9, 11
CountDay = 30
Case 2
CountDay = 29
End Select
End Function
Private Sub Command1_Click()
month = Text1.Text
Text2.Text=CountDay(month)
End Sub