求一段代码,用VB编程实现一个日历程序!!!

2024-10-31 11:32:12
推荐回答(4个)
回答1:

给你个简便易行的代码。
==========================
Private Sub Form_Load()
While 1
Dim y As Integer, m As Integer, d As Integer, s As Date, x As Integer, r As String
y = InputBox("请输入年份", , Format(Now, "yyyy"))
m = InputBox("请输入月份", , Format(Now, "mm"))
d = InputBox("请输入日期", , Format(Now, "dd"))
s = DateSerial(y, m, d)
x = Weekday(s)
Select Case x
Case 1
r = "日"
Case 2
r = "一"
Case 3
r = "二"
Case 4
r = "三"
Case 5
r = "四"
Case 6
r = "五"
Case 7
r = "六"
End Select
MsgBox "星期" & r
Wend
End Sub

回答2:

那没有什么难的 画面上放40个控件数组 然后算就可以了!~

回答3:

选择菜单“工程-部件...”,在弹出的窗口中选择“Microsoft Windows Common Controls-2 6.0 (SP6)”,点击“确定”按钮后,在工具箱内就会出现日历控件,双击该控件,就可以使用现成的日历了。

回答4:

咳咳!这还要简单点,你等一年,看有人答得出来不,如果只是公历我想应该不难。