用VB设计一个带提示功能的日历程序
程序在装载时显示当前的年月日,且在日期右侧显示星期和年月日的信息。
点击年或者月,下面的日期要随着实际年月所应有的天数发生变化。
点击Cancel按钮退出当前程序。
在文本框中输入指定格式的提示信息,并保存在记事本中。
根据提示信息的日期当选定有提示信息的日期时弹出消息框提示用户
或者告诉我你的邮箱 我把详细的内容发给你 展开
你的程序设计有缺点,提醒功能是在几点钟实现,总不可能一天到晚都提醒吧?
Dim Temp As String
Dim MyDay As Date
Dim MyMsg As String
Private Sub Calendar1_Click()
Dim Week As String
Select Case Weekday(Calendar1.Value) - 1
Case 0
Week = "星期日"
Case 1
Week = "星期一"
Case 2
Week = "星期二"
Case 3
Week = "星期三"
Case 4
Week = "星期四"
Case 5
Week = "星期五"
Case 6
Week = "星期六"
Case Else
End Select
lbDate.Caption = "提醒时间:" & vbCrLf & vbCrLf & Calendar1.Year & "年" & Calendar1.Month & "月" & Calendar1.Day & "日" & vbCrLf & Week
End Sub
Private Sub cmdCancel_Click()
Call Form_Load
With Calendar1
.Year = Year(Date)
.Month = Month(Date)
.Day = Day(Date)
End With
lbMsg.Caption = "输入要提示的信息。"
End Sub
Private Sub cmdSave_Click()
Open App.Path & "\Msg.txt" For Output As #1
Write #1, Calendar1.Value
Write #1, txtMsg.Text
Close #1
MsgBox "信息保存成功!", vbOKOnly, "提示"
lbMsg.Caption = "提醒时间:" & Calendar1.Value
End Sub
Private Sub Form_Load()
'On Error Resume Next
Dim Week As String
Select Case Weekday(Date) - 1
Case 0
Week = "星期日"
Case 1
Week = "星期一"
Case 2
Week = "星期二"
Case 3
Week = "亏链星期三"
Case 4
旁档 Week = "星期四"
Case 5
Week = "星期五"
Case 6
Week = "星期六"
Case Else
End Select
lbDate.Caption = "提醒时间:" & vbCrLf & vbCrLf & Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日" & vbCrLf & Week
Open App.Path & "\Msg.txt" For Input As #1
Line Input #1, Temp
While Not EOF(1)
Input #1, MyMsg
Wend
Close #1
lbMsg.Caption = Temp
txtMsg.Text = MyMsg
End Sub
Private Sub Timer1_Timer()
If Year(Date) = Val(Mid(Temp, 2, 4)) And Month(Date) = Val(Mid(Temp, 7, 2)) And Day(Date) = Val(Mid(Temp, 10, 2)) Then Beep
End Sub
Private Sub txtMsg_Change()
If Len(txtMsg.Text) > 0 Then
cmdSave.Enabled = 运空乱True
Else
cmdSave.Enabled = False
End If
End Sub
2024-07-20 广告
175147310