vb代码,生成一个二维数组,打印,格式左对齐,并将数组保存到文件中。

发布网友 发布时间:2024-10-24 02:23

我来回答

1个回答

热心网友 时间:2024-10-26 10:54

Dim a(10, 10) As Integer
Dim str As String
Private Sub Command1_Click()
Dim i, j As Integer
For i = 1 To 10
For j = 1 To 10
a(i, j) = Int(Rnd * 5000)
str = str & a(i, j) & Space(7 - Len(CStr(a(i, j))))
Next j
str = str & vbCrLf
Next i
Print str;
End Sub

Private Sub Command2_Click()
'¸²¸ÇдÎļþ
Open "D:\1234567890.txt" For Output As #1
Print #1, str
Close #1
MsgBox ("дÈëÎļþÍê³É£¡")
End Sub

Private Sub Form_Load()
str = ""
End Sub
声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-MAIL:11247931@qq.com