单击窗体,使用select case结构讲一年中的12个月份分成4个季节,并用print输出
PrivateSubForm_Load()'单击窗体显示季节DimxAsIntegerDimyAsIntegerSelectCasexCase1y="冬季"Case2To...
Private Sub Form_Load()
'单击窗体显示季节
Dim x As Integer
Dim y As Integer
Select Case x
Case 1
y = "冬季"
Case 2 To 4
y = "春季"
Case 5 To 7
y = "夏季"
Case 8 To 10
y = "秋季"
Case 11 To 12
y = "冬季"
Print "月份是" & x
Print "季节是" & y
End Select
End Sub
却显示不出来,哪里错了? 展开
'单击窗体显示季节
Dim x As Integer
Dim y As Integer
Select Case x
Case 1
y = "冬季"
Case 2 To 4
y = "春季"
Case 5 To 7
y = "夏季"
Case 8 To 10
y = "秋季"
Case 11 To 12
y = "冬季"
Print "月份是" & x
Print "季节是" & y
End Select
End Sub
却显示不出来,哪里错了? 展开
3个回答
展开全部
Private Sub Form_Click()
'单击窗体显示季节
Dim x As Integer
Dim y As String
x = Month(Now)
Select Case x
Case 1
y = "冬季"
Case 2 To 4
y = "春季"
Case 5 To 7
y = "夏季"
Case 8 To 10
y = "秋季"
Case 11 To 12
y = "冬季"
Print "月份是" & x
Print "季节是" & y
End Select
End Sub
'单击窗体显示季节
Dim x As Integer
Dim y As String
x = Month(Now)
Select Case x
Case 1
y = "冬季"
Case 2 To 4
y = "春季"
Case 5 To 7
y = "夏季"
Case 8 To 10
y = "秋季"
Case 11 To 12
y = "冬季"
Print "月份是" & x
Print "季节是" & y
End Select
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询