vb编程中“子程序或函数未定义”,求教子程序或函数该如何定义?
PrivateSubCommand1_Click()Diml%,m%,n%,o%,x%,y%,A%,B%,C%,D%,i%,j%n=7m=14l=14o=21Fori=1...
Private Sub Command1_Click()
Dim l%, m%, n%, o%, x%, y%, A%, B%, C%, D%, i%, j%
n = 7
m = 14
l = 14
o = 21
For i = 1 To 6
n = n + 1
A = Text(n) - Text7
For j = 1 To 6
m = m + 1
B = Text(m)
If B = A Then
For x = 1 To 6
l = l + 1
C = Text(l) - Text21
For y = 1 To 6
o = o + 1
D = Text(o)
If D = C Then
Print D
End If
Next
Next
End If
Next
Next
End Sub 展开
Dim l%, m%, n%, o%, x%, y%, A%, B%, C%, D%, i%, j%
n = 7
m = 14
l = 14
o = 21
For i = 1 To 6
n = n + 1
A = Text(n) - Text7
For j = 1 To 6
m = m + 1
B = Text(m)
If B = A Then
For x = 1 To 6
l = l + 1
C = Text(l) - Text21
For y = 1 To 6
o = o + 1
D = Text(o)
If D = C Then
Print D
End If
Next
Next
End If
Next
Next
End Sub 展开
2个回答
展开全部
Private Sub Command1_Click()
Dim l%, m%, n%, o%, x%, y%, A%, B%, C%, D%, i%, j%
n = 7
m = 14
l = 14
o = 21
For i = 1 To 6
n = n + 1
A = Controls("Text" & n) - Text7
For j = 1 To 6
m = m + 1
B = Controls("Text" & m)
If B = A Then
For x = 1 To 6
l = l + 1
C = Controls("Text" & l) - Text21
For y = 1 To 6
o = o + 1
D = Controls("Text" & o)
If D = C Then
Print D
End If
Next
Next
End If
Next
Next
End Sub
追问
老兄,还是不行啊,运行时说“编译错误:必选参数”,提示“Text7”。?
展开全部
你这个题出现错误的原因不是什么“子程序或函数未定义”问题,
而是,你在程序运行之前,必须确保有text(1),text(2),text(3),text(4),text(5)和text(6)六个控件!(并注意这是一个控件数组!)
而是,你在程序运行之前,必须确保有text(1),text(2),text(3),text(4),text(5)和text(6)六个控件!(并注意这是一个控件数组!)
追问
有控件,可我怎么确定它是一个控件数组?
追答
你看控件的名字来判断是不是控件数组。
如果是text1,text2......这样子的,数字上没有括号,就不是控件数组;
数字带括号的如text(1),text(2),text(3),text(4),text(5)和text(6)就是控件数组。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询