我有一个从文本文件中读取的类,并将其添加到集合中。我试图弄清楚如何在加载程序时从集合中读取以填充组合框。
计费数据类
Public ReadOnly Property Clients As Collection
Get
Return mClients
End Get
End Property
Sub New()
mClientFile = OpenText("clients.txt")
Dim mClients As New Collection
While Not mClientFile.EndOfStream
mClients.Add(mClientFile.ReadLine())
End While
mClientFile.Close()
主窗体
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
client = New BillingData()
Dim i As Integer
While i < client.Clients.Count
cbClient.Items.AddRange(client.Clients(i))
i = i + 1
End While
End Sub