|
楼主 |
发表于 2023-2-28 20:21
|
显示全部楼层
老师你好,在vb6.0中我要把txt文本逐条写入fpSpread1控件第2列中,Command1运行时无显示,但Command2中a值能正常填写,麻烦你看看问题所在,谢谢!
Private Sub Command1_Click()
Dim t As String, aa, a As Long, b As Long
CommonDialog1.ShowOpen '打开对话框 CommonDialog为文本控件,要添加
t = CommonDialog1.FileName '获取文件名
Open t For Input As #1 '打开文件并读入
aa = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf) '将文件号转换
Close #1
For b = 0 To UBound(aa)
If Len(aa(b)) Then
a = a + 1
Me.fpSpread1.SetText 2, a, aa(b) '赋值
End If
Next
End Sub
下面测试时 a值能正常填写
Private Sub Command2_Click()
a = 2
For i = 1 To 6
Me.fpSpread1.SetText 2, i, a 'SetText 列, 行 参数
a = a + 1
Next
End Sub
|
|