我是一个 .net 新手,我遇到了一个问题,列表框需要很长时间才能显示出来。
这在 java 中是不一样的(花费的时间非常少 - 最多一秒)。
那么,有什么补救措施吗??,任何其他形式的控制??或其他方式?
imports System.Threading
imports System.Windows.Forms
Class form1
Inherits Form
Public d As Object() = New Object(400000) {}
Private lb As ListBox
Public Sub New()
lb = New ListBox()
Controls.Add(lb)
End Sub
Public Sub update_list()
For i As Integer = 0 To 400000
d(i) = i
Next
lb.DataSource = d
End Sub
Public Shared Sub main()
Dim fobj As New form1()
Dim t As New Thread(AddressOf fobj.ShowDialog)
t.Start()
Dim t2 As New Thread(AddressOf fobj.update_list)
t2.Start()
End Sub
End Class