MenuStrip to RadMenu issues

3 posts, 1 answers
  1. Sanchit
    Sanchit avatar
    3 posts
    Member since:
    Jul 2014

    Posted 26 Aug 2014 Link to this post

    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
            '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
            For Each m As Machine In mwl
                m.Enabled = True
        End Sub

        Private Sub CreateMenuControlCollection()
            For Each mi As ToolStripMenuItem In MenuStrip1.Items
                mcc.Add(mi, mi.Text)
        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)
                    End If
            End If
        End Sub

  2. Answer
    Stefan avatar
    2906 posts

    Posted 26 Aug 2014 Link to this post

    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.

    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.
  3. Sanchit
    Sanchit avatar
    3 posts
    Member since:
    Jul 2014

    Posted 26 Aug 2014 in reply to Stefan Link to this post

    Thank You....I was overlooking the method that was automatically generate when switching things over 
Back to Top