This is a migrated thread and some comments may be shown as answers.

MenuStrip to RadMenu issues

2 Answers 90 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Sanchit
Top achievements
Rank 2
Sanchit asked on 26 Aug 2014, 02:18 PM

Just purchased telerik and in the process of converting winforms to teleriks components.  
I started off with the error of "Value of type 'Telerik.WinControls.RadItem' cannot be converted to 'System.Windows.Forms.ToolStripMenuItem'".  So I changed all ToolStripMenuItem to "RadMenuItem".  This solved the above error.

But created a new error "Private Sub AddMenuChildren(ByRef mi As Telerik.WinControls.UI.RadMenuItem)' and 'Private Sub AddMenuChildren(mi As Telerik.WinControls.UI.RadMenuItem)' cannot overload each other because they differ only by parameters declared 'ByRef' or 'ByVal'"


Any Help with the above error would be appreciated.
Below is my code:

Private Sub LockMain()
        'This subroutine handles the locking of the Main windows'
        '   menu options and child windows. It first iterates
        '   through all menu control collection items disabling
        '   them. It then iterates through all the machine 
        '   windows disabling them. It then enables a select few
        '   menu options.

        For i = 1 To mcc.Count
            CType(mcc.Item(i), ToolStripMenuItem).Enabled = False
        Next
        'If mwa IsNot Nothing Then
        '    For Each m As Machine In mwa
        '        m.Enabled = False
        '    Next
        'End If
        LogONOFFToolStripMenuItem.Enabled = True
        LogOnToolStripMenuItem.Enabled = True
        HelpToolStripMenuItem.Enabled = True
        AboutToolStripMenuItem.Enabled = True
        ViewManualToolStripMenuItem.Enabled = True
    End Sub

    Private Sub UnlockPermissions()
        Dim sp As New SecurityProfile_(mcn, ud(4))
        For Each i As ToolStripMenuItem In mcc
            If sp.GetProperty(i.Text) Then
                i.Enabled = True
            End If
        Next
        For Each m As Machine In mwl
            m.Enabled = True
        Next
    End Sub

    Private Sub CreateMenuControlCollection()
        For Each mi As ToolStripMenuItem In MenuStrip1.Items
            mcc.Add(mi, mi.Text)
            AddMenuChildren(mi)
        Next
    End Sub

    Private Sub AddMenuChildren(ByRef mi As ToolStripMenuItem)
        If mi.DropDownItems IsNot Nothing Then
            For Each c As Object In mi.DropDownItems
                Dim mc As ToolStripMenuItem = TryCast(c, ToolStripMenuItem)
                If mc IsNot Nothing Then
                    mcc.Add(mc, mc.Text)
                    AddMenuChildren(mc)
                End If
            Next
        End If
    End Sub


2 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 26 Aug 2014, 03:27 PM
Hi Sanchit,

Thank you for writing.

It seems that your methods are the same and you can safely remove one of them and keep using the other.

I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Sanchit
Top achievements
Rank 2
answered on 26 Aug 2014, 05:31 PM
Thank You....I was overlooking the method that was automatically generate when switching things over 
Tags
Menu
Asked by
Sanchit
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Sanchit
Top achievements
Rank 2
Share this question
or