VB中出现编译错误,必选参数

OptionExplicitOptionBase1PrivateSubCommand1_Click()DimA(4,4)AsInteger,iAsInteger,jAsI... Option Explicit
Option Base 1
Private Sub Command1_Click()
Dim A(4, 4) As Integer, i As Integer, j As Integer, k As Integer
For i = 1 To 4
For j = 1 To 4
k = k + 1
A(i, j) = k
Next j
Next i
Call transform(A)
For i = 1 To 4
For j = 1 To 4
Text1 = Text1 & Right(" " & A(i, j))
Next j
Text1 = Text1 & vbCrLf
Next i
End Sub
Private Sub transform(A() As Integer)
Dim i As Integer, j As Integer, n As Integer, t As Integer, k As Integer
n = UBound(A, 1)
k = n + 1
For i = 1 To n / 2
For j = 1 To n
If i <> j And j <> k - i Then
t = A(i, j)
A(i, j) = A(k - i, k - j)
A(k - i, k - j) = t
End If
Next j
Next i
End Sub
展开
 我来答
catwym
2012-03-08 · TA获得超过1240个赞
知道小有建树答主
回答量:671
采纳率:66%
帮助的人:555万
展开全部
问题出在 Text1 = Text1 & Right(" " & A(i, j)) 中的Right函数
其格式为:Right(“字符串”,长度)) 表示从右边截取几个字符。
正确的为: Text1 = Text1 & Right(" " & A(i, j),1)
但这样看不出你要表达什么意思,其实这道题目中完全可以不用right,直接如下所示就可以了
Text1 = Text1 & " " & A(i, j)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式