图片附件: 游客没有浏览图片的权限,请
登录 或
注册
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
第一个是设计界面,第二个是运行界面。下面是代码,你是不是将MSFlexGrid1控件误写为vsflexgrid控件了?
程序代码:
Dim LJWJM As String
Private Sub Command1_Click()
CommonDialog1.Filter = "txt文件(.txt)|*.txt"
CommonDialog1.ShowOpen
LJWJM = CommonDialog1.FileName
If LJWJM <> "" Then
Command2.Enabled = True
Command1.Enabled = False
End If
End Sub
Private Sub Command2_Click()
Dim X(1 To 5) As String, N As Integer, I As Integer
Open LJWJM For Input As #1
Do While Not EOF(1)
N = N + 1
Input #1, X(N)
Loop
Close #1
MSFlexGrid1.Clear
MSFlexGrid1.Visible = True
With MSFlexGrid1
.Cols = 6
.Rows = 2
.TextMatrix(0, 0) = "A"
.TextMatrix(0, 1) = "B"
.TextMatrix(0, 2) = "C"
.TextMatrix(0, 3) = "D"
.TextMatrix(0, 4) = "E"
.TextMatrix(0, 5) = "F"
For I = 1 To 5
.TextMatrix(1, 0) = 1
.TextMatrix(1, I) = X(I)
Next I
End With
End Sub
仅仅就你的问题中的数据存储在文本文件中,就5行。
[此贴子已经被作者于2016-5-15 20:23编辑过]