473,466 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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()
Nov 21 '05 #1
3 2511
Hi,

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

Ken

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

"Carlos Fandango" <cf*******@hotmail.com> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
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()

Nov 21 '05 #2
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

"Carlos Fandango" <cf*******@hotmail.com> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...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()

Nov 21 '05 #3
D'oh thanks for the tip!

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:#p*************@TK2MSFTNGP12.phx.gbl...
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

"Carlos Fandango" <cf*******@hotmail.com> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
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()


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
14
by: Mark Allison | last post by:
Hi, I am new to C# and want to create my own events within a console app. However I am struggling mentally with this, and have looked at the MSDN documentation but I am drawing a blank. Is there...
1
by: Manco | last post by:
1. A delegate is a type-safe, object-oriented function pointer. 2. A delegate declartion is C-sharp, f.e., public delegate void MyDelegate(int); defines a MulticastDelgate which contains a...
5
by: | last post by:
I am wondering what the best method of attaching custom Events to custom WebUserControls are. I cannot seem to find the proper terminology to expand my research. Basicallly I have a custom user...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
1
by: Scott M. | last post by:
I'm trying to get my head around what's involved in C# to declare, raise and respond to an event. I'm coming from the VB.NET world where to declare and event we wrote: Public Event Foo() To...
5
by: Daniel | last post by:
Hey guys When you hook an event (c# 2.0 syntax): myEvent += MyMethodToFire; You need to also unsubscribe it to avoid a resource leak so that the object it is in gets garbage collected like so...
7
by: Siegfried Heintze | last post by:
I'm studying the book "Microsoft Visual Basic.NET Language Reference" and I would like some clarify the difference between events and delegates. On page 156 I see a WinForms example of timer that...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.