急求:VB.NET 如何加快读取文本速度

iscooller 2008-08-26 02:47:55
Dim objReader As System.IO.StreamReader
objReader = New System.IO.StreamReader(Application.StartupPath + "\txt\蔬菜检测\目录.txt", System.Text.Encoding.GetEncoding("GB2312"))
Dim sLine As String = ""
Dim arrText As New ArrayList()
Do
sLine = objReader.ReadLine()
If Not sLine Is Nothing Then
arrText.Add(sLine)
End If

Loop Until sLine Is Nothing

objReader.Close()


Label1.Text = arrText(0)
Label2.Text = arrText(1)
Label3.Text = arrText(2)
Label4.Text = arrText(3)
Label5.Text = arrText(4)
Label6.Text = arrText(5)



为什么label的显示内容是一个个出来 而不是一下子都出来的,如何加快速度 ,谢谢!
...全文
182 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
iscooller 2008-08-26
  • 打赏
  • 举报
回复
顶 没人晓得了么?
iscooller 2008-08-26
  • 打赏
  • 举报
回复
帮忙帮忙~~~
iscooller 2008-08-26
  • 打赏
  • 举报
回复
你回车的高度和我想要放的位置不一样么!
HimeTale 2008-08-26
  • 打赏
  • 举报
回复
Dim arrText As New List(Of String);

大概能快一点点
skigil 2008-08-26
  • 打赏
  • 举报
回复
vbcrlf跟图片有啥关系啊?
skigil 2008-08-26
  • 打赏
  • 举报
回复
怎么可能呢?你的文件很大吗/
iscooller 2008-08-26
  • 打赏
  • 举报
回复
to:skigil vbcrlf 跟图片对不上 显示还是一个个出来滴
iscooller 2008-08-26
  • 打赏
  • 举报
回复
呵呵 还是一样 是不是读取的方法不对哦
skigil 2008-08-26
  • 打赏
  • 举报
回复
什么位置难控制?
yanlongwuhui 2008-08-26
  • 打赏
  • 举报
回复
那就把Me.ResumeLayout(False)改成Me.ResumeLayout(True)
iscooller 2008-08-26
  • 打赏
  • 举报
回复
速度差不多, 位置也难控制了
skigil 2008-08-26
  • 打赏
  • 举报
回复
一行行读,当然有时间差,这个是VB特有的缺陷,建议这样做:
dim s as string=my.computer.filesystem.readalltext(Application.StartupPath + "\txt\蔬菜检测\目录.txt", System.Text.Encoding.GetEncoding("GB2312"))

dim arrText() as string=s.split(vbcrlf)'这个函数有重载的哦
Label1.Text = arrText(0)
Label2.Text = arrText(1)
Label3.Text = arrText(2)
Label4.Text = arrText(3)
Label5.Text = arrText(4)
Label6.Text = arrText(5)

试试吧
iscooller 2008-08-26
  • 打赏
  • 举报
回复
没什么变化么!!!
yanlongwuhui 2008-08-26
  • 打赏
  • 举报
回复
试下:
Me.SuspendLayout()
Label1.Text = arrText(0)
Label2.Text = arrText(1)
Label3.Text = arrText(2)
Label4.Text = arrText(3)
Label5.Text = arrText(4)
Label6.Text = arrText(5)
Me.ResumeLayout(False)
LQknife 2008-08-26
  • 打赏
  • 举报
回复
vb啊 帮顶

16,722

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧