Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6719473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:05:50+00:00 2026-05-26T09:05:50+00:00

I have created a custom designer ( PannelloSfondoDesigner ) for my custom control, a

  • 0

I have created a custom designer (PannelloSfondoDesigner) for my custom control, a background panel (PannelloSfondo).

<Designer(GetType(PannelloSfondo.PannelloSfondoDesigner))>
Public Class PannelloSfondo
    Inherits UserControl

    Friend Class PannelloSfondoDesigner
        Inherits ParentControlDesigner

        Public Overrides Sub Initialize(ByVal component As IComponent)
            MyBase.Initialize(component)

            verbDock = New DesignerVerb("Dock to parent container", New EventHandler(AddressOf Me.OnDock))
            verbUndock = New DesignerVerb("Undock from parent container", New EventHandler(AddressOf Me.OnUndock))
            verbs = New DesignerVerbCollection()

            If Me.Control.Dock = DockStyle.Fill Then
                verbs.Add(verbUndock)
            Else
                verbs.Add(verbDock)
            End If
        End Sub

        Public Overrides ReadOnly Property Verbs() As DesignerVerbCollection
            Get
                Return verbs
            End Get
        End Property

        Private Sub OnDock(ByVal sender As Object, ByVal e As EventArgs)
            'Dim verbo As DesignerVerb = DirectCast(sender, DesignerVerb)
            verbs.Clear()
            verbs.Add(verbDock)
            Me.Control.Dock = DockStyle.Fill
        End Sub

        Private Sub OnUndock(ByVal sender As Object, ByVal e As EventArgs)
            verbs.Clear()
            verbs.Add(verbUndock)
            Me.Control.Dock = DockStyle.None
        End Sub

        Public Overrides Function CanBeParentedTo(ByVal parentDesigner As IDesigner) As Boolean
            Return True
        End Function

        Private verbs As DesignerVerbCollection = Nothing
        Private verbDock As DesignerVerb
        Private verbUndock As DesignerVerb
    End Class

End Class

It works, I click the little arrow, the context menu appears:

control's context menu

I click the menu item, the event is fired, the control is docked:

menu clicked

but the menu description is not updated or refreshed (it should show “Undock from parent container”). Then if I click outside the control to deselect it and then I click back on the arrow to show the menu, the right menu item is displayed:

right menu text displayed

How do I refresh the menu items?!
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:05:50+00:00Added an answer on May 26, 2026 at 9:05 am

    Do you possibly have your verbs mixed up?

    In your code, when you are Dock-Filling it, your clear the verbs, and then adding the verbDock, not verbUndock.

    Private Sub OnDock(ByVal sender As Object, ByVal e As EventArgs)
      'Dim verbo As DesignerVerb = DirectCast(sender, DesignerVerb)
      verbs.Clear()
    
      'Switch verbs:
      'verbs.Add(verbDock)
      verbs.Add(verbUndock)
    
      Me.Control.Dock = DockStyle.Fill
    End Sub
    
    Private Sub OnUndock(ByVal sender As Object, ByVal e As EventArgs)
      verbs.Clear()
    
      'Switch verbs:
      'verbs.Add(verbUndock)
      verbs.Add(verbDock)
    
      Me.Control.Dock = DockStyle.None
    End Sub
    

    Update:

    Try changing your designer class to not clear the collection, just toggle the Visible properties of your Verb collection:

    Public Overrides Sub Initialize(ByVal component As IComponent)
      MyBase.Initialize(component)
    
      verbDock = New DesignerVerb("Dock to parent container", New EventHandler(AddressOf Me.OnDock))
      verbUndock = New DesignerVerb("Undock from parent container", New EventHandler(AddressOf Me.OnUndock))
      verbs = New DesignerVerbCollection()
      verbs.Add(verbDock)
      verbs.Add(verbUndock)
    
      If Me.Control.Dock = DockStyle.Fill Then
        verbDock.Visible = False
      Else
        verbUndock.Visible = False
      End If
    End Sub
    
    Private Sub OnDock(ByVal sender As Object, ByVal e As EventArgs)
      Me.Control.Dock = DockStyle.Fill
      verbUndock.Visible = True
      verbDock.Visible = False
    End Sub
    
    Private Sub OnUndock(ByVal sender As Object, ByVal e As EventArgs)
      Me.Control.Dock = DockStyle.None
      verbDock.Visible = True
      verbUndock.Visible = False
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom control that inherits System.Windows.Forms.Panel, and adds a few extra
I have created a custom activity with an InArgument like so: public sealed class
I have implemented a custom designer class which inherits from DocumentDesigner. The standard Form
I have created the custom control which is just a panel that I will
I have created a custom data grid control. I dragged it on windows form
I have a bit of a strange issue here. I created a custom control
I have created a Custom Edit Form for a custom list using SharePoint designer.
I have created a configuration section designer project to represent nodes of a custom
I have a custom VB.NET control that I created that is working correctly in
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.