Designer verbs on user controls

G

Grinning Crow

I am trying to design a re-usable wizard control with design time
functionality to add and remove wizard "pages" (which will take the form of a
collection of panels onto which the developer will be able to add controls at
design time).

The class for the user control is this (not including the automatically
created .Designer.vb code):

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Windows.Forms.Design


<Designer(GetType(MyWizardRootDesigner), _
GetType(IRootDesigner))> _
Public Class MyWizard
Inherits UserControl

'My code for handling back,next,cancel etc goes here

End Class


The designer is this:

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Diagnostics
Imports System.Drawing.Design
Imports System.Windows.Forms
Imports System.Windows.Forms.Design

<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Public Class MyWizardRootDesigner
Inherits ParentControlDesigner

Public Overrides Sub Initialize(ByVal component As IComponent)
MyBase.Initialize(component)
Me.Verbs.Add(New DesignerVerb("Insert page", New
EventHandler(AddressOf OnVerbInsertPage)))
Me.Verbs.Add(New DesignerVerb("Delete current page", New
Eventhandler(AddressOf OnVerbDeletePage)))
End Sub

Private Sub OnVerbInsertPage(ByVal sender As Object, ByVal e As EventArgs)
MsgBox("This verb inserts a page") 'to test designer verb
End Sub

Private Sub OnVerbDeletePage(ByVal sender As Object, ByVal e As EventArgs)
MsgBox("This verb deletes a page") 'to test designer verb
End Sub

End Class


As you might have guessed, I've adapted this from one of the walkthroughs in
the online help. However, when I've built the project and added the control
to the form, it doesn't show the designer verbs and doesn't allow me to add
controls with the user control as parent.

Can anyone tell me where I'm going wrong?

Thanks in advance
 
G

Grinning Crow

Well, as seems to always be the way, 5 mins after posting, I found that the
designer attribute changed to

<Designer(GetType(MyWizardRootDesigner))>

i.e. without the bit about IRootDesigner

fixed both problems.

so... yeah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top