- 积分
- 623
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-12-18
- 最后登录
- 1970-1-1
![未绑定新浪微博用户 新浪微博达人勋](source/plugin/sina_login/img/gray.png)
|
发表于 2013-7-22 18:50:53
|
显示全部楼层
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'VB.NET读取TXT文件数据保存为数组
Dim f = My.Application.Info.DirectoryPath & "\" & "1.txt"
Dim txt As IO.StreamReader = New IO.StreamReader(f, System.Text.Encoding.Default)
Dim str(200) As String, n As Integer = 0
Do Until txt.EndOfStream
n = n + 1
ReDim Preserve str(n) '数组从1开始
str(n) = txt.ReadLine()
Loop
txt.Close()
TextBox1.Text = Mid(str(3), 1, 1)
End Sub |
|