从另一个类vb.net访问列表

时间:2012-01-04 18:23:00

标签: vb.net

我有这两个类的类FootballAdmin利用项目引用中的导入Football,我需要做的是在MainForm类中使用updateView方法访问FootballAdmin持有的列表并将其显示在teamSheetListBox中,i我不确定如何访问列表,如?????

Imports Football

Public Class FootballAdmin

  Private fTeam As List(Of FootballTeams)

  Public Sub New()
    fTeam = New List(Of FootballTeams)
  End Sub

  Public ReadOnly Property Teams() As List(Of FootballTeams)
    Get
      Return fTeams
   End Get
  End Property
End Class

Public Class MainForm    
  Private fFootballAdmin As FootballAdmin

  Public Sub New()
    InitializeComponent()
    fFootballAdmin = New FootballAdmin
    updateView()
  End Sub

  Private sub updateView()    
    For each team As String In ????????
      teamSheetListBox.Items.Add(team)
    Next   
  End Sub
End Class

请帮忙!

1 个答案:

答案 0 :(得分:2)

我要给你的重要提示是你的团队:

For each team As String In ????????
  teamSheetListBox.Items.Add(team)
Next

不会是一个字符串。它将与您的FootballAdmin类中的FootballTeam相同。考虑一下您可以在MainForm中访问哪些内容,以获取这些类型。