时间计算器

时间计算器,第1张

概述Private Sub Form_Load() '控制界面大小 Me.Height = 5820 Me.Width = 7080End SubPrivate Sub Label_calculate_Click()'时间机算按钮 '清空时间记录 Label.Caption = "" '判断输入框的多种情况 If T

Private Sub Form_Load()    '控制界面大小    Me.Height = 5820    Me.WIDth = 7080End SubPrivate Sub Label_calculate_Click()'时间机算按钮    '清空时间记录    Label.Caption = ""    '判断输入框的多种情况    If Text_bTime.Text = "" And Text_sTime.Text = "" Then        MsgBox "您还没有输入时间,请输入时间!"        '把光标移到开始时间的输入框        Text_bTime.SetFocus    ElseIf Text_bTime.Text = "" And Text_sTime.Text <> "" Then        If IsDate(Text_sTime.Text) = True Then            MsgBox "您还没有输入开始时间,请输入!"            '把光标移到开始时间的输入框            Text_bTime.SetFocus        Else            MsgBox "您还没有输入开始时间,请输入!并且截止时间格式错误,格式为:" & Now            Text_bTime.SetFocus            Text_sTime.Text = ""        End If    ElseIf Text_bTime.Text <> "" And Text_sTime.Text = "" Then        If IsDate(Text_bTime.Text) = False Then            MsgBox "您输入的开始时间不是时间格式,请输入时间格式,格式为:" & Now            '清空输入框            Text_bTime.Text = ""            '把光标移到开始时间的输入框            Text_bTime.SetFocus        Else            MsgBox "您没有输入截止时间,默认此时为截止时间。"            '调用机算过程            Call r_Times        End If    ElseIf IsDate(Text_bTime.Text) = False And IsDate(Text_sTime.Text) = False Then        MsgBox "您输入格式错误,格式如:" & Now        '清空输入框        Text_bTime.Text = ""        Text_sTime.Text = ""        '把光标移到开始时间的输入框        Text_bTime.SetFocus    ElseIf IsDate(Text_bTime.Text) = True And IsDate(Text_sTime.Text) = True Then        '调用机算过程        Call j_Times    ElseIf IsDate(Text_bTime.Text) = False And IsDate(Text_sTime.Text) = True Then        MsgBox "您输入的开始时间有误,请重新输入!"        Text_bTime.Text = ""        Text_bTime.SetFocus    ElseIf IsDate(Text_bTime.Text) = True And IsDate(Text_sTime.Text) = False Then        MsgBox "您输入的截止时间有误,请重新输入!"        Text_sTime.Text = ""        Text_sTime.SetFocus    Else        MsgBox "您的输入有误,请重新输入!"        '清空输入框        Text_bTime.Text = ""        Text_sTime.Text = ""        '把光标移到开始时间的输入框        Text_bTime.SetFocus    End IfEnd SubPublic Sub r_Times()    '如果没有输入截止时间时,默认此时为截止时间    Label.Caption = "到此时相隔:" & DateDiff("yyyy",Text_bTime.Text,Now) & "年" & Chr(10)    Label.Caption = Label.Caption & DateDiff("q",Now) & "季节" & Chr(10)    Label.Caption = Label.Caption & DateDiff("m",Now) & "月" & Chr(10)    Label.Caption = Label.Caption & DateDiff("ww",Now) & "周" & Chr(10)    Label.Caption = Label.Caption & DateDiff("d",Now) & "天" & Chr(10)    Label.Caption = Label.Caption & DateDiff("h",Now) & "小时" & Chr(10)    Label.Caption = Label.Caption & DateDiff("n",Now) & "分钟" & Chr(10)    Label.Caption = Label.Caption & DateDiff("s",Now) & "秒"End SubPublic Sub j_Times()    '机算时间    Label.Caption = "相隔:" & DateDiff("yyyy",Text_sTime.Text) & "年" & Chr(10)    Label.Caption = Label.Caption & DateDiff("q",Text_sTime.Text) & "季节" & Chr(10)    Label.Caption = Label.Caption & DateDiff("m",Text_sTime.Text) & "月" & Chr(10)    Label.Caption = Label.Caption & DateDiff("ww",Text_sTime.Text) & "周" & Chr(10)    Label.Caption = Label.Caption & DateDiff("d",Text_sTime.Text) & "天" & Chr(10)    Label.Caption = Label.Caption & DateDiff("h",Text_sTime.Text) & "小时" & Chr(10)    Label.Caption = Label.Caption & DateDiff("n",Text_sTime.Text) & "分钟" & Chr(10)    Label.Caption = Label.Caption & DateDiff("s",Text_sTime.Text) & "秒" & Chr(10)End Sub

用VB写的时间计算器

总结

以上是内存溢出为你收集整理的时间计算器全部内容,希望文章能够帮你解决时间计算器所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1294511.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存