how to show progress while load the text?

sarmad

Active member
Joined
Jan 22, 2006
Messages
37
Programming Experience
1-3
hi

i have a rich textbox and i have to load a large text in it

i want to show the progress bar or waiting message to user

while the text loaded complete

is there any way?



so thanks
 
Add a ProgressBar to your form, set it's min/max to 0/100 (for percent).
Here is some code that will read a textfile while calculating and displaying progress in percent:
VB.NET:
Dim f As New IO.FileInfo(Application.StartupPath & "\textfile.txt")
Dim filelength As Long = f.Length
Dim sr As New IO.StreamReader(f.FullName)
Me.RichTextBox1.Text = ""
Do While sr.Peek() >= 0
  RichTextBox1.AppendText(sr.ReadLine() & vbNewLine)
  ProgressBar1.Value = RichTextBox1.TextLength * 100 \ filelength
Loop
sr.Close()
ProgressBar1.Value = 0
 
Back
Top