用VB select case语句实现输入年月日输出有几天怎么做

如题所述

第1个回答  2017-07-13
请将问题表述完整追问

追答Select Case m
                Case 1, 3, 5, 7, 8, 10, 12
                    d = 31
                Case 4, 6, 9, 11
                    d = 30
                Case 2
                    If (y Mod 4 = 0 And y Mod 100 <> 0) Or y Mod 400 = 0 Then
                        d = 29
                    Else
                        d = 28
                    End If
            End Select

输入某年某月输出这一个月有多少天vb用IF和Select语句
Private Sub Command1_Click()y = CInt(InputBox("请输入年"))m = CInt(InputBox("请输入月"))Select Case m Case 1, 3, 5, 7, 8, 10, 12 d = 31 Case 4, 6, 9, 11 d = 30 Case 2 If y Mod 4 = 0 And y Mod 100 <> 0 Or y Mod 400 = 0 Then d = 29 Else ...

...输出该月对应的天数的代码 要求用 select case 实现
Text)Text3.Text = DateDiff("d", myYear & "-" & myMonth & "-" & "1", myYear & "-" & myMonth + 1 & "-" & "1")End SubPrivate Sub Form_Load()Text1.Text = Year(Date) 'text1中输入年份Text2.Text = 1 'text2中输入月份Text3.Text = "" 'text3中输入月份对应...

vb实现输入某一天年月日,计算这一天在本年中的天数,有图最好,谢谢了
Case 1, 3, 5, 7, 8, 10 d = d + 31 Case 4, 6, 9, 11 d = d + 30 Case 2 d = d + 28 End Select Next i If m > 2 And (y Mod 4 = 0 And y Mod 100 <> 0 Or y Mod 400 = 0) Then d = d + 1 MsgBox (s & "是" & y & "年的第" & d & "天...

求VB程序,输入年月日求星期几?
Dim myYear, myMonth, myDay, myWeek, Days As Integer Dim myDate As String myYear = Val(TextY.Text) myMonth = Val(TextM.Text) myDay = Val(TextD.Text) If myYear < 1980 Or myYear > 9999 Then MsgBox "输入的年份应在[1980, 9999]之间" Exit Sub End If If myMonth < 1...

VB编程 用select case编写程序完成输入
a a=Inputbox("输入成绩")a=int(a)select case a case a>=90 or a=< 100 Msgbox "优秀"case a>=80 or a=< 89 Msgbox "优良"case a>=70 or a=< 79 Msgbox "中等"case a>=60 or a=< 69 Msgbox "及格"case a<60 Msgbox "不合格"case else Msgbox "输入错误"end select ...

vb中给出三个InputBox依次输入年月日计算是当年第几天
iYear = InputBox("输入年份")iMonth = InputBox("输入月份")iDay = InputBox("输入日期")num = iDay For i = 1 To iMonth - 1 Select Case i Case 2 num = num + IIf(iYear Mod 400 = 0 Or iYear Mod 4 = 0 And iYear Mod 100 <> 0, 29, 28)Case 1, 3, 5, 7,...

VB中select case 语句的用法
不能用“Time”关键字做变量名称。还有“Now”包括了时间和日期,而前面随机生成的时间不包括日期,会导致判断错误。代码可改为:Private Sub Command1_Click()RandomizeDim rTime As DaterTime = rTime + RndPicture1.Print "今天 " & rTimeSelect Case rTimeCase Is > TimePicture1.Print "距...

VB中如何使用select case语句
别误会,Select Case不是循环语句,是条件选择语句,与IF...ELSEIF...ELSEIF...END IF类似。基本用法Private Sub main()Select Case InputBox("请输入你希望的天气,从晴天、多云、阴天、阵雨、小雨、小雪、冰雹中选一个填入。", "请输入你希望的天气", "晴天")Case "晴天"MsgBox "哇哦!你...

vb程序设计输入一个数字1~7,分别用select语句和choose函数两种方法...
case 1 debug.print "Monday"case 2 debug.print "Tuseday"……end select end if end sub private sub command2_click() 'choose方法 text1.text =int(val(text1.text))if text1.text >0 and text1.text <8 then i = text1.text debug.print choose(i,"Monday","Tuseday",……,"...

如何编写一个VB程序输入年月日用中文显示星期几
Select Case Weekday(Now, vbMonday)Case 1 Form1.Caption = "星期一"Case 2 Form1.Caption = "星期二"Case 3 Form1.Caption = "星期三"Case 4 Form1.Caption = "星期四"Case 5 Form1.Caption = "星期五"Case 6 Form1.Caption = "星期六"Case 7 Form1.Caption = "星期日"End ...

相似回答