dkfr.net
当前位置:首页 >> vB读取txt文件 到数组 >>

vB读取txt文件 到数组

dim strline as string dim a() dim i as integer open app.path +"\1.txt for input as #1 do until eof(#1) i=i+1 line input #1,strline redim preserve a(i) a(i-1)=strline loop

如果TXT文件是单行的话 Open "c:\1.txt" For Binary As #1 Text1.Text = Input(lof(1), 1) Close #1 Dim a a = Split(Text1.Text) 如果是多行要加循环 Option Explicit Dim a$, n%, k%, c$(), d% Private Sub Form_Click() n = 0 Open App.Path ...

如果TXT文件是单行的话 Open "c:\1.txt" For Binary As #1 Text1.Text = Input(lof(1), 1) Close #1 Dim a a = Split(Text1.Text) 如果是多行要加循环 Option Explicit Dim a$, n%, k%, c$(), d% Private Sub Form_Click() n = 0 Open App.P...

Private Sub Command1_Click() Dim i As Integer '因为数据里有冒号,所以采用字符串格式 Dim d() As String Dim LStr() As String Dim H As Integer Dim L() As String '先将数据读取到动态数组LStr(),假设文本文件存放于与程序文件同一个文件...

Private Sub Command1_Click() Dim arr, i As Long Open "c:\123.txt" For Input As #1 arr = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbNewLine) Close #1 For i = 0 To UBound(arr) Print arr(i) Next End Sub

你要做什么计算?aa和bb都可以用于计算的 Private Sub Command1_Click() Dim aa(), bb(), a, b, n As Integer, i As Integer, fname As String fname = "d:\1.txt" '文件名,可自行更改 '获得文本文件的行数,实际行数为n+1 Open fname For Bina...

Dim A(), B(), C(), D(), E() '数据类型不详,可以不声明数据类型,首先声明动态数组Dim X As Integer, Y As IntegerOpen "C:\ABC\123.txt" For Input As #1 '读取123.txt文本文件的数据If Not EOF(1) ThenX = X + 1 '首先得到文本文件的总行数E...

VB.NET编程读取txt文本文档中的数据,并把数据保存为数组,代码如下: '写配件文件Private Sub saveIni(ByVal filePath As String, ByVal str As String)Dim sw As StreamWriter = New StreamWriter(filePath, True) 'true是指以追加的方式打开...

如下: Private Sub Output_Click() Dim filePath As String Dim fileNo As Integer Dim i As Integer On Error GoTo err1 With CommonDialog1 .DialogTitle = "请输入文件名" .Filter = "文本文档(*.txt)|*.txt" .InitDir = App.Path .CancelErr...

①方法简介:使用Visual Basic按行保存列表框选中项到txt,然后按行读取保存到数组。 设置listbox的style属性为1,使他显示复选框。利用listbox的selected属性获得选中项的数据。并将其按顺序保存到变量Str中,在C盘创建txt文件并保存。然后使用l...

网站首页 | 网站地图
All rights reserved Powered by www.dkfr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com