PC Review


Reply
Thread Tools Rate Thread

Designer verbs on user controls

 
 
Grinning Crow
Guest
Posts: n/a
 
      25th Mar 2008
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
 
Reply With Quote
 
 
 
 
Grinning Crow
Guest
Posts: n/a
 
      25th Mar 2008
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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0 User Controls Viewed in the Designer... WadeC Microsoft ASP .NET 0 3rd Mar 2006 12:20 AM
User controls breaking in designer Charlie@CBFC Microsoft ASP .NET 1 1st Nov 2005 02:48 PM
Forms designer and user controls =?Utf-8?B?RGFuIEluZ2FsbGE=?= Microsoft Dot NET Framework Forms 0 3rd Mar 2005 10:11 PM
Updating the PropertyGrids Designer Verbs Jacob Microsoft C# .NET 2 20th Oct 2004 04:33 PM
User Controls and Designer msnews.microsoft.com Microsoft Dot NET Framework Forms 0 18th May 2004 08:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:20 AM.