Events declared with an 'As' clause must have a delegate type.

  • Thread starter Thread starter Carlos Fandango
  • Start date Start date
C

Carlos Fandango

I am converting a C# sample and have not use VB in years, I suspect this
will not be my first post;

I have a event declared as;

Namespace Callisto.Utils.UI.Navigation

' <summary>

' A handler for several events generated by the Page class.

' </summary>

Public Delegate Sub PageEventHandler(ByVal sender As Object, ByVal e As
PageEventArgs)

End Namespace



When I try and use it in the code below I get the error from the title, any
pointers?



Public Class Page

Inherits System.Windows.Forms.UserControl

' <summary>

' Event fired when the frame is navigating into the page.

' </summary>

<Description("Occurs when the frame is navigating into the page."), _

Category("Behaviour")> _

Public Event PageEnter As PageEventHandler()
 
Hi,

Public Event PageEnter(ByVal sender As Object, ByVal e As PaintEventArgs)



Ken

--------------------------------

I am converting a C# sample and have not use VB in years, I suspect this
will not be my first post;

I have a event declared as;

Namespace Callisto.Utils.UI.Navigation

' <summary>

' A handler for several events generated by the Page class.

' </summary>

Public Delegate Sub PageEventHandler(ByVal sender As Object, ByVal e As
PageEventArgs)

End Namespace



When I try and use it in the code below I get the error from the title, any
pointers?



Public Class Page

Inherits System.Windows.Forms.UserControl

' <summary>

' Event fired when the frame is navigating into the page.

' </summary>

<Description("Occurs when the frame is navigating into the page."), _

Category("Behaviour")> _

Public Event PageEnter As PageEventHandler()
 
Carlos,
When I try and use it in the code below I get the error from the title,
any
pointers?
Public Event PageEnter As PageEventHandler()

You defined PageEnter to be an Array of PageEventHandler delegates, as the
error suggests you need to define PageEnter as a single PageEventHandler
delegate.

Try:
Public Event PageEnter As PageEventHandler

Hope this helps
Jay
 
D'oh thanks for the tip!

Jay B. Harlow said:
Carlos,


You defined PageEnter to be an Array of PageEventHandler delegates, as the
error suggests you need to define PageEnter as a single PageEventHandler
delegate.

Try:
Public Event PageEnter As PageEventHandler

Hope this helps
Jay
 

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

Back
Top