Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / December 2006

Tip: Looking for answers? Try searching our database.

Events Sample that I can then use in VB with With Evnets keyword

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce - 23 Dec 2006 04:28 GMT
I have a DotNet C++ class that I would like to fire an event to then be
used by VB.Net using the With Events keyword.  I have experience
creating connection point events for ActiveX controls, it is actually
very easy with the ATL wizard but I am lost when it comes to C++ .Net's
 events.

Can anyone please point me to an example in VC++ .Net that allows me to
then use the component in VB with the With Events keyword?

Bruce
Bruno van Dooren [MVP VC++] - 23 Dec 2006 07:41 GMT
> I have a DotNet C++ class that I would like to fire an event to then be
> used by VB.Net using the With Events keyword.  I have experience creating
[quoted text clipped - 3 lines]
> Can anyone please point me to an example in VC++ .Net that allows me to
> then use the component in VB with the With Events keyword?

Hi,
do a search on www.codeproject.com. you will find lots of examples.
that site is always my starting point when i need samples.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"

Bruce - 23 Dec 2006 14:22 GMT
>> I have a DotNet C++ class that I would like to fire an event to then be
>> used by VB.Net using the With Events keyword.  I have experience creating
[quoted text clipped - 7 lines]
> do a search on www.codeproject.com. you will find lots of examples.
> that site is always my starting point when i need samples.

Thanks Bruno.  Code Project is a wonderful website but I have yet to
find an example that has a really good sample of events.

After some searching, I would this one:

http://groups.google.com/group/microsoft.public.dotnet.general/browse_thread/thr
ead/14b579fc024d2564/d21a58507e01e84e?lnk=st&q=__event++vb+sAMPLE&rnum=3#d21a585
07e01e84e


But it does not show how to use the class with, With Event keyword in VB.

Also the delegate is declared outside the class that is the source of
the event.  Is this normal?

Bruce
Bruno van Dooren [MVP VC++] - 23 Dec 2006 21:09 GMT
Hi,

> Thanks Bruno.  Code Project is a wonderful website but I have yet to find
> an example that has a really good sample of events.
[quoted text clipped - 4 lines]
>
> But it does not show how to use the class with, With Event keyword in VB.

For that you could ask in the vb group. I wouldn't know how to do something
specific in VB.

For testing this part of your problem, you could create a C# class that
exports an event.
That would probably easier for you to find info about.

For using a .NET event in a specific way, it does not matter which language
the assembly was created with.

> Also the delegate is declared outside the class that is the source of the
> event.  Is this normal?

This should not be a problem. It could be a generic delegate that is used in
lots of classes
Btw, that sample is for MC++, which is a deprecated syntax.
C++/CLI is the definite way for using .NET in C++.
do a search for C++/CLI event, and you should get some positive hits.

these 2 things should be a lot easier to figure out separately.
Once you know them both you can then combine them.
Hope this helps.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"

Bruce - 23 Dec 2006 21:26 GMT
> Hi,

> For that you could ask in the vb group. I wouldn't know how to do something
> specific in VB.
[quoted text clipped - 15 lines]
> Once you know them both you can then combine them.
> Hope this helps.

Thanks again Bruno,

I am still using VC7.  (Too cheap to upgrade to VC8, though I do have
the Express Version).  Does C++/CLI events work for VC7?

I am still searching for some sample code.

Bruce
Ben Voigt - 26 Dec 2006 18:10 GMT
>> Hi,
>
[quoted text clipped - 22 lines]
> I am still using VC7.  (Too cheap to upgrade to VC8, though I do have the
> Express Version).  Does C++/CLI events work for VC7?

VC8 Express beats VC7 any version for almost any purpose.

> I am still searching for some sample code.
>
> Bruce
Tamas Demjen - 29 Dec 2006 00:19 GMT
> Does C++/CLI events work for VC7?

The C++/CLI language was introduced in VC8. VC7 requires you to use the
old MC++ syntax, not the new C++/CLI one.

Tom
Bruce - 23 Dec 2006 21:29 GMT
> Hi,

>> But it does not show how to use the class with, With Event keyword in VB.
>
[quoted text clipped - 7 lines]
> For using a .NET event in a specific way, it does not matter which language
> the assembly was created with.

> This should not be a problem. It could be a generic delegate that is used in
> lots of classes
[quoted text clipped - 5 lines]
> Once you know them both you can then combine them.
> Hope this helps.

P.S.  I must use C++ because I am building a managed wrapper for an
existing C++ unmanaged library.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.