Has adding menu items changed recently?

1 Answer 24 Views
Menu
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Ian asked on 16 Mar 2023, 11:27 AM

My code has LOTS of places where it sets-up new menu items, like:

 With delMenu.Items
            .Add(New RadMenuItem("..section from document", New EventHandler(AddressOf mnuDeleteSectionFromDocument_Click)))

...etc

I am moving it all over to a new version of my app, which is, I think, using a newer verison of the winforms framework.

This code still comiles, but doesn't create the link from the menu item to the address handler, whereas the more long-form approach works just fine:

  Dim aMenuItem = New RadMenuItem("test")
        AddHandler aMenuItem.Click, AddressOf mnuTest
        delMenu.Items.Add(aMenuItem)

Was there a change in the APi, in which case I need to change everything, or is there another way to create all the menu options and their handlers quickly?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Mar 2023, 05:54 AM

Hello, Ian,

I have tested with a few previous versions and none of them actually subscribes to the Click event of the menu item. That is why it would be greatly appreciated if you can specify the old Telerik version in which this approach for subscribing to the Click event was working. 

    Sub New()
         
        InitializeComponent()

        With Me.RadMenu1.Items
            .Add(New RadMenuItem("..section from document", New EventHandler(AddressOf mnuDeleteSectionFromDocument_Click)))
        End With 
    End Sub

    Private Sub mnuDeleteSectionFromDocument_Click()
        RadMessageBox.Show("Clicked")
    End Sub

Thus, we would be able to make an adequate analysis of the precise case and provide further assistance. Thank you in advance.

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Menu
Asked by
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or