好的,这是相关的代码:
Public Shared compSelect(9) As ComboBox
Public Shared compPercent(9) As TextBox
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Data.LoadComponents("C:/Users/Jon/Documents/Visual Studio 2013/Projects/QuickBlend/QuickBlend/QuickBlend/Resources/databaseText.txt")
MsgBox("finished loading")
MainForm.compSelect = {CompSelect1, CompSelect2, CompSelect3, CompSelect4, CompSelect5, CompSelect6, CompSelect7, CompSelect8, CompSelect9, CompSelect10}
MainForm.compPercent = {CompPercent1, CompPercent2, CompPercent3, CompPercent4, CompPercent5, CompPercent6, CompPercent7, CompPercent8, CompPercent9, CompPercent10}
For Each box As ComboBox In MainForm.compSelect
box.DataSource = Data.Components
box.DisplayMember = "Name"
For Each comp As String In Data.ComponentNames
box.Items.Add(comp)
Next
MsgBox("looped")
Next
MsgBox("finished loop")
End Sub
如您所见,我放置了各种 MsgBoxes 来查看到底发生了什么。它从不显示“循环”消息框。谁能向我解释为什么它完全跳过了 for 循环?已经为此工作了一段时间并且厌倦了它。在此先感谢您的帮助!=)