VB帮我看一下代码

来源:百度知道 编辑:UC知道 时间:2024/05/05 04:44:27
界面地址:
http://hi.baidu.com/jack%5Fican/album/item/9fcea6dd5f54eee977c63823.html

代码如下:

Dim a, b, c, d As Integer
Dim f As Date

Private Sub cmdcount_Click()
a = txtyear1.Text
b = txtmonth1.Text
c = txtday1.Text
d = Date
f = CDate(a & "-" & b & "-" & c)
lblsiqing = d - f
End Sub

Private Sub cmdend_Click()
End
End Sub

Private Sub cmdqingling_Click()
txtyear1.Text = ""
txtmonth1.Text = ""
txtday1.Text = ""
lblxingzuo.Caption = ""
lblsiqi.Caption = ""
lblshengyu.Caption = ""
lblshengxiao.Caption = ""
lblnianling.Caption = ""
End Sub

Private Sub Label10_Click()

End Sub

Private Sub Label

那你不如把abc都定义成字符串变量,我刚才试了一下
f = CDate(a + "-" + b + "-" + c),如果是字符串就不会报错

用一个时间选择控件就行了啊, 没有那么麻烦的。