If (MonthView1.Month = mvwJanuary) And (MonthView1.Day = 2) Then
Private Sub Command1_Click() Dim strMsg As String Dim currentMonth As Integer Dim currentDay As Integer currentMonth = MonthView1.Month currentDay = MonthView1.DayIf currentMonth = 1 And currentDay = 2 Then strMsg = "today is your birthday! :)" Label3.Caption = strMsg Else strMsg = "Today will be a good day." strMsg = strMsg & "I wish you have a good time!:)" Label3.Caption = strMsg End If End Sub 还是不能显示不同信息,是不是要写change函数!?
Dim strMsg As String
Dim currentMonth As Integer
Dim currentDay As Integer
currentMonth = MonthView1.Month
currentDay = MonthView1.DayIf currentMonth = 1 And currentDay = 2 Then
strMsg = "today is your birthday! :)"
Label3.Caption = strMsg
Else
strMsg = "Today will be a good day."
strMsg = strMsg & "I wish you have a good time!:)"
Label3.Caption = strMsg
End If
End Sub
还是不能显示不同信息,是不是要写change函数!?
或者做个form出来,试试
我想应该不是refresh的问题
我把输出的消息定位到一个消息窗口也不行!
是控件问题还是我的条件判断有问题?
判断的问题: (MonthView1.Month = mvwJanuary) = ture And (MonthView1.Day = 2) = ture =〉(MonthView1.Month = mvwJanuary) = true And (MonthView1.Day = 2) = true
我没处理过时间,不过我看过点,好象Mouth和Date是取出月份和日期的,你不访试一下。
currentDay = MonthView1.Day
我知道这是返回当前月份和当前日
然后我判断是否是1月2号
难道and不是“与“的意思!?当我把系统时间改为1月2号
他输出的依然是else语句块里面的msg
DAY(now())判断今天几号
用
MONTH(now())判断今天几月
用
year(now())判断今天是什么年
得出来得是数字型
Thanks for your help !to:all
Every problem have been solved.
I'll check out at once!
Thanks.
呵呵,谢谢你的指导
继续学习!
顺,便说一下,我以前学习vc现在要用 vb做数据库,所以学习下,发现vb在某方面确实很好。
一开始if else还不会用呢,哈哈
还以为跟vc里面的一样,没想到还要加什么then。希望大家以后多多关照
谢谢!!