1个回答
展开全部
Private Sub Command1_Click()
Dim tx() As String, tmp As String, n As Integer
'首先将txt文件里面非空行的内容读进数组tx里
Open "d:\a.txt" For Input As #1
n = 0
Do While Not EOF(1)
Line Input #1, tmp
If tmp <> "" Then
ReDim Preserve tx(n)
tx(n) = tmp
n = n + 1
End If
Loop
Close #1
'然后就清空txt文件,把数组tx里面的内容写进去就可以了
Open "d:\a.txt" For Output As #2
Cls
For i = 0 To UBound(tx)
Print #2, tx(i)
Next
Close #2
'如果你是要将过滤了空行的内容读进文本框里面,那么:
For i = 0 To UBound(tx)
Text1.Text = Text1.Text & tx(i) & vbCrLf
Next
End Sub
Dim tx() As String, tmp As String, n As Integer
'首先将txt文件里面非空行的内容读进数组tx里
Open "d:\a.txt" For Input As #1
n = 0
Do While Not EOF(1)
Line Input #1, tmp
If tmp <> "" Then
ReDim Preserve tx(n)
tx(n) = tmp
n = n + 1
End If
Loop
Close #1
'然后就清空txt文件,把数组tx里面的内容写进去就可以了
Open "d:\a.txt" For Output As #2
Cls
For i = 0 To UBound(tx)
Print #2, tx(i)
Next
Close #2
'如果你是要将过滤了空行的内容读进文本框里面,那么:
For i = 0 To UBound(tx)
Text1.Text = Text1.Text & tx(i) & vbCrLf
Next
End Sub
TableDI
2024-07-18 广告
2024-07-18 广告
`VLOOKUP` 匹配出错误的数据通常是由于以下几个原因:1. **查找值错误**:输入的查找值与数据源中的值不匹配,可能是因为拼写错误、大小写不一致或存在不可见的字符。2. **查找区域设置错误**:查找区域的首列必须包含要查找的值,且...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询