I have a Form2 with ListBox, i fill the listbox with the content of big size text file, this isn't the problem but the problem is occur when showing Form2, the form take long time to show.
I tried ListView control, but it is act the same.
How can i fix this?
Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim s As Single = Microsoft.VisualBasic.Timer
Form2.ListBox1.Items.AddRange(IO.File.ReadAllLines("C:\Test.txt"))' this file contains about 500000 lines
MsgBox(Microsoft.VisualBasic.Timer - s)' the time is about 0.03 seconds
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As Single = Microsoft.VisualBasic.Timer
Form2.Show()
MsgBox(Microsoft.VisualBasic.Timer - s)' the time is about 5 seconds
End Sub
How can i fix this?