Audax321 Posted July 20, 2003 Posted July 20, 2003 Hello, I am having the same problem as the person that posted this thread was having: http://www.xtremedotnettalk.com/showthread.php?s=&threadid=74437&highlight=menu+item Basically, I have a list of items in a listbox that are dynamically added to a submenu in a context menu. And the items add fine everytime. But, the submenu only expands once. If I go back to access it, the submenu just has an arrow and no menu pops up. The number of items in the submenu indicate that the menu is properly creating all of the new menu items, just not showing them. From what I've seen in VB.NET so far, M$ really screwed up context menus. Let me know if any of you have suggestions... Also, check out my other thread: http://www.xtremedotnettalk.com/showthread.php?s=&postid=374628#post374628 Thanks :( Quote
Moderators Robby Posted July 20, 2003 Moderators Posted July 20, 2003 Microsoft did not screw-up the context menus! What does your relevant code look like? Quote Visit...Bassic Software
Audax321 Posted July 20, 2003 Author Posted July 20, 2003 Here is my code: Private Sub ContextMenu5_Popup(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContextMenu5.Popup If (lstPlaylist.Items.Count > 0) Then mnuPlaylist.Enabled = True mnuPlaylist.MenuItems.Clear() Dim i As Integer For i = 0 To lstPlaylist.Items.Count - 1 mnuPlaylist.MenuItems.Add(MediaName, AddressOf PlaylistMenuHandler) Next For i = 0 To lstPlaylist.Items.Count - 1 MediaName = lstPlaylist.GetItemText(lstPlaylist.Items.Item(i)) mnuPlaylist.MenuItems.Item(i).Text = Mid(MediaName, 1, InStr(MediaName, "<") - 1) Next mnuPlaylist.MenuItems.Item(GetCurrentPlayingIndex).Checked = True Else mnuPlaylist.Enabled = False End If End Sub Protected Sub PlaylistMenuHandler(ByVal sender As Object, ByVal e As System.EventArgs) Dim item As MenuItem item = DirectCast(sender, MenuItem) AxWindowsMediaPlayer1.controls.playItem(AxWindowsMediaPlayer1.currentPlaylist.Item(item.Index)) End Sub It works fine once and fails every other time.... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.