0
我有一個主窗體的窗體項目。有一個文本框離開事件會打開一個新窗體。在新的表單加載事件中,我有一個組合框項目循環來填充組合框項目。如果在主表單上運行,但在第二個表單上運行,則它工作得很好。爲什麼當通過主窗體中的textbox_leave事件打開窗體時,輔助窗體上的組合框不會填充? 這是假事件組合框沒有被填充
Private Sub tbChartTitle_Leave(sender As Object, e As System.EventArgs) Handles tbChartTitle.Leave
If Not tbChartTitle.Text = Nothing Then
frmTitleAttributes.Show()
End If
End Sub
這是填充第二窗體上的組合框的一個代碼(它如果主窗體上的組合框運行Works)
Private Sub frmTitleAttributes_Load(sender As Object, e As System.EventArgs) Handles Me.Load
InitializeComponent()
AddFonts()
End Sub
Private Sub AddFonts()
' Get the installed fonts collection.
Dim allFonts As New Drawing.Text.InstalledFontCollection
' Get an array of the system's font familiies.
Dim fontFamilies() As FontFamily = allFonts.Families
' Display the font families.
For i As Integer = 0 To fontFamilies.Length - 1
cbxTitleFonts.Items.Add(fontFamilies(i).Name)
Next
End Sub
謝謝。我發現調用load load中的initializecomponent會導致問題 – dinotom