473,657 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

raise events from a nested class

Hello, somebody know how to raise an event from a nested class?

I have two classes, the class1 with 1 events, and a
nested class (class2) inside the class1. So... How can I raise class1 events
from the class2?

Public Class class1
Public Shared Event Evento1(ByRef sender As Object)

Public Class class2
Public Sub Pippo()
RaiseEvents MioEvento 'error !!!!!!
End Sub
End Class
End Class
Thanks a lot!!
Nov 21 '05 #1
2 2076
if i remember well, you must to use a delegate.... but may be im wrong...
--
Salute by the First Time!
"Pietro" wrote:
Hello, somebody know how to raise an event from a nested class?

I have two classes, the class1 with 1 events, and a
nested class (class2) inside the class1. So... How can I raise class1 events
from the class2?

Public Class class1
Public Shared Event Evento1(ByRef sender As Object)

Public Class class2
Public Sub Pippo()
RaiseEvents MioEvento 'error !!!!!!
End Sub
End Class
End Class
Thanks a lot!!

Nov 21 '05 #2
Add an event and raise it in Class 2 then in the Class 1 handler for the
Class 2 event, raise the Class 1 Event. Of course, in Class 1, you must
declare Class2 WithEvents.
--
Dennis in Houston
"Rothariger " wrote:
if i remember well, you must to use a delegate.... but may be im wrong...
--
Salute by the First Time!
"Pietro" wrote:
Hello, somebody know how to raise an event from a nested class?

I have two classes, the class1 with 1 events, and a
nested class (class2) inside the class1. So... How can I raise class1 events
from the class2?

Public Class class1
Public Shared Event Evento1(ByRef sender As Object)

Public Class class2
Public Sub Pippo()
RaiseEvents MioEvento 'error !!!!!!
End Sub
End Class
End Class
Thanks a lot!!

Nov 21 '05 #3

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

Similar topics

0
1313
by: askingBoy | last post by:
Hello , I would like to know how to make this : I have a library written in Visual Basic .Net that has some events for its class , I am making an instance of this class in a Visual basic 6.0 Project and I can call the methods from the object I instanced . However I cannot raise the events from this library with my object , I already made a sub in the vb 6.0 in the form : Private Sub object_Event() 'Some code here End Sub
1
10513
by: Dan Cimpoiesu | last post by:
I have a remoting object, derived from MarshalByRefComponent, that I instantiate on the client side, with Activator.GetObject. Can I receive events fired on the server, on the client? How?
1
2259
by: AA | last post by:
Hello, somebody know how to raise an event from a nested class?? This is my situation... I have two classes, the class1 with 2 events, and a nested class (class2) inside the class1. So... How can I raise class1 events from the class2? Thanks a lot!!
2
1910
by: Andrew | last post by:
Hi, friends, I need to raise certain events in my VC# windows control library. Any reference paper or sample source code for help? Thanks a lot...
4
4534
by: Jeremy | last post by:
I have a combobox with a SelectionChangeCommitted event handler, and am having a problem raising this event. For example, raiseEvent mycombobox.SelectionChangeCommitted gives me an error about not being ended properly. But it won't accept parameters either. What's the trick here?
1
1847
by: Rethish R | last post by:
Hi, I have defined few Events in VB.Net, Register the DLL using "Register Interop for COM" Option. Now I have referred the class in VB 6.0. That is add the referrence for the DLL. But I am not able to declare the Events and invoke the events in VB 6.0 Please have a look at the VB code Private WithEvents eHandle as <NameSpace>.<ClassName>
3
1931
by: Carmella | last post by:
Is it possible for a class to create an instance of a private nested class which raises events and then listen for those events? In the example below, when InnerClass sings, OuterClass should say Bravo . I am not sure about the scoping and I cannot get this to work. Thanks Mel Public Sub OuterClass Public Event Bravo() Protected WithEvents MyInnerClass as InnerClass
1
9935
by: Anonieko | last post by:
I know Visual Studio lacked support on easily writing code to raise events from a ascx user control ( because you have to hand write them). (http://codebetter.com/blogs/brendan.tompkins/archive/2004/10/06/27795.aspx) Question: Is it better and easier now in ASPNET 2.0 , meaning VS 2005?
11
4019
by: nadeem_far | last post by:
Hello, I am working on a c# project using framework 1.1. Since its a console application,no windows forms are being used. I am trying to implement event driven classes that just want to raise the event and continue working( like fire and forget - do not wait for the event handler in client to finish.) I have gone through alot of the articles on internet and MSDN and most talk about delegates (or BackGroundWorker in 2.0 which I cannot
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7354
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.