
vb6.0 自定义函数问题
PrivateFunctionriqi1()Label1(i).Caption=""Label1(i).BorderStyle=0NextiStartDay=CStr(y...
Private Function riqi1()
Label1(i).Caption = ""
Label1(i).BorderStyle = 0
Next i
StartDay = CStr(year1) + "-" + CStr(month1) + "-" + "01"
StartWeek = Weekday(CDate(StartDay))
Select Case Val(month1)
Case 1, 3, 5, 7, 8, 10, 12: MaxDate = "31"
Case 4, 6, 9, 11: MaxDate = "30"
Case 2: If year1 Mod 4 = 0 Then MaxDate = "29" Else MaxDate = "28"
End Select
For i = StartWeek - 1 To MaxDate + StartWeek - 2
Label1(i).Caption = i - StartWeek + 2
End Function
这个函数是定义的
下面为什么调用不出来啊Private Sub Command1_Click()
Dim month1 As Integer, year1 As Integer
'If SelecteDate = 0 Then Exit Sub
month1 = cboMonth.ListIndex + 1
year1 = Val(List1.Text)
Call riqi1(month1, year1) 展开
Label1(i).Caption = ""
Label1(i).BorderStyle = 0
Next i
StartDay = CStr(year1) + "-" + CStr(month1) + "-" + "01"
StartWeek = Weekday(CDate(StartDay))
Select Case Val(month1)
Case 1, 3, 5, 7, 8, 10, 12: MaxDate = "31"
Case 4, 6, 9, 11: MaxDate = "30"
Case 2: If year1 Mod 4 = 0 Then MaxDate = "29" Else MaxDate = "28"
End Select
For i = StartWeek - 1 To MaxDate + StartWeek - 2
Label1(i).Caption = i - StartWeek + 2
End Function
这个函数是定义的
下面为什么调用不出来啊Private Sub Command1_Click()
Dim month1 As Integer, year1 As Integer
'If SelecteDate = 0 Then Exit Sub
month1 = cboMonth.ListIndex + 1
year1 = Val(List1.Text)
Call riqi1(month1, year1) 展开
2个回答
展开全部
你的函数么参数的
SelecteDate么赋值 永远是0 每次都exit sub 了 就这俩问题
SelecteDate么赋值 永远是0 每次都exit sub 了 就这俩问题
展开全部
Private Function riqi1(byval year1 as integer,byval month1 as integer)
更多追问追答
追问
还是不行啊,它说缺少for 能加下扣扣说吗?
我的分数全都给你了
追答
for i=0 to 5 '你这里少写for语句
Label1(i).Caption = ""
Label1(i).BorderStyle = 0
Next i
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询