我在表單加載中將項目作爲下拉菜單添加到菜單。菜單欄菜單下拉項目名稱在msgbox中顯示爲空白
從相同的子我嘗試在msgbox中輸出menustrip下拉項目,但我得到了我的所有項目的空白響應。
Private Sub PopulateLoadChildMenu()
msItemLoad.DropDownItems.Clear()
Dim fi As FileInfo
If Directory.GetFiles(_playlistpath).Length > 1 Then
msItemLoad.Enabled = True
End If
For Each fi In _files
msItemLoad.DropDownItems.Add(Path.GetFileNameWithoutExtension(_playlistpath & fi.Name))
Next
For Each MyMenuItem As ToolStripMenuItem In msItemLoad.DropDownItems
txbList.Text = txbList.Text & ", " & MyMenuItem.Tag
Next
End Sub
我用它在Sub這樣
Private Sub FormLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fi As FileInfo
msItemLoad.Enabled = False
If Directory.GetFiles(_playlistpath).Length = 1 Then
For Each fi In _files
LoadPlaylist(_playlistpath & fi.Name)
Next
End If
PopulateLoadChildMenu()
End Sub
它們是否顯示在您的菜單中? –