473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Exposing .NET events to COM for use in VB6 projects

Hello Everyone,

I have a class that I wrote in Visual Basic .NET (using version
1.0 of the Framework). It exposes one public event. I would like to be
able to declare an instance of the class in a Visual Basic 6.0 project
using the standard "WithEvents" syntax. In the .NET project, I set the
"Register for COM Interop" option in
Project->Properties->Configuration->Build and I wrapped the event
declaration in a public interface definition, and I also set the
ComSourceInterfaces attribute to use the interface. I can reference
the .NET library in VB 6.0 and the event shows up in the Object
Browser, but instantiating the class with WithEvents seems to have no
effect. Here is a stripped-down snippet of the .NET code to show how I
declared and set the COM source interface (note that the vertical
ellipses represent omitted code):

..
..
..

Imports System.Runtime.InteropServices

Public Interface IFtpClientEvents
Sub ClientError(ByVal ErrorString As String)
End Interface

<ComSourceInterfaces(GetType(IFtpClientEvents))> _
Public Class FtpClient

..
..
..

End Class

If anyone needs a more detailed description, let me know.
Jul 21 '05 #1
1 1641
Hi Mike,

Did you know that there is a newsgroup

microsoft.public.dotnet.languages.vb.upgrade

However that is not to active therefore you maybe can send this problem
better to the newsgroup and the few who are active in the upgrade newsgroup
are as well active in the newsgroup.

microsoft.public.dotnet.languages.vb

Or crossposted (one message to both)

I hope you find your answer there.

Cor
Jul 21 '05 #2

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

Similar topics

0
by: Patrick Blackman | last post by:
I have created a component in C# and have registered the component for use in com. I have put the following attributes on the component class : public class Thesaurus:Component
3
by: Trevor | last post by:
Hello, How can I setup an event in C#? I would like for class A to have an event, and class B to intercept the event. Class B should not be able to call the event itself, only class A. How is...
3
by: Jacob | last post by:
I'm working on a class that needs to be called from a windows form, do it's work, and then, show progress back to the main form. I'm well aware that worker threads need to call Invoke for updates...
0
by: ariesc | last post by:
I upgraded from .NET 2002 to .NET 2003 and found one weird things on the LEAVE / ENTER events within a datagrid. I added handler to each textbox of a datagrid, then handle the ENTER/LEAVE events....
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...
0
by: doron | last post by:
Hi all, I'm exposing an orchestration as a web service which simply replies the same object it receives by calling an internal ws I wrote which does the same thing. (getting the object and...
2
by: Terry | last post by:
I am finally able to call my .Net object from a VB6 project (see posting 'Calling VB.Net classes from VB6', thanks to the reference Tony gave me to:...
1
by: Adam Clauss | last post by:
First, I have ComVisible set to true for the entire assembly. I have (abstract) base class A. There are interfaces IA and IAEvents for accessing properties of this object and exposing events. ...
7
hodgeman
by: hodgeman | last post by:
Hello thescripts forums users... I've found a lot of answers to problems I've had in the past from this forum, and this is the first mySQL query issue I haven't been able to find an answer from...
3
by: galathaea | last post by:
it surprises me how often engineers confuse states with actions i think this is the fundamental reification behind procedural statemess and this mistake infects a lot of great projects with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.