473,385 Members | 1,372 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,385 software developers and data experts.

.NET class events handling in VB6

I wrote a component using C# and I need to use it from a Visual Basic 6
client application.
The C# object raises an event which uses a custom delegate, but I don't know
how to catch the event in VB6.

Please help me!! ;-)
Nov 15 '05 #1
2 4011
Leonardo,

If you use the TLBEXP utility, it should create a TLB that you can
import into VB6. Once you have that, you can declare your object with the
"WithEvents" modifier and you should be able to handle the object normally.

Of course, this is assuming that you are correctly attributing your
object so that it is suitable for COM interop.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Leonardo Spina" <le********************@tecnolink.it> wrote in message
news:z3********************@news2.tin.it...
I wrote a component using C# and I need to use it from a Visual Basic 6
client application.
The C# object raises an event which uses a custom delegate, but I don't know how to catch the event in VB6.

Please help me!! ;-)

Nov 15 '05 #2
I did it and it seems to work until I attempt to access the object (like I
try to call a method) when it says
"method T of object O failed" (error 80070002)

where "T" is not a method but the name of the instance of the .NET object
that I am accessing through COM Interop and "O" is the COM object "parent"
of my object "T"

what does it mean?

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> ha
scritto nel messaggio news:Op**************@TK2MSFTNGP11.phx.gbl...
Leonardo,

If you use the TLBEXP utility, it should create a TLB that you can
import into VB6. Once you have that, you can declare your object with the
"WithEvents" modifier and you should be able to handle the object normally.
Of course, this is assuming that you are correctly attributing your
object so that it is suitable for COM interop.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Leonardo Spina" <le********************@tecnolink.it> wrote in message
news:z3********************@news2.tin.it...
I wrote a component using C# and I need to use it from a Visual Basic 6
client application.
The C# object raises an event which uses a custom delegate, but I don't

know
how to catch the event in VB6.

Please help me!! ;-)


Nov 15 '05 #3

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

Similar topics

2
by: Chris Crowe | last post by:
Hi I am trying to create a Javascript class, and have this class handle events for an INPUT control such as "onkeydown" I can get this to work using the code below, but my question is how do I...
6
by: Jon Hyland | last post by:
Ok, I'm a little rusty on this, it should be a simple problem but I can't figure it out. How can I handle form events in my main code page?? I'm creating a Windows App in C#. Rather than make...
18
by: Elder Hyde | last post by:
Hey all, A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate,...
10
by: Opa | last post by:
I have tried for two days to solve this problem with no luck. I have a singleton class which has some events declared. When I inherit from this class the events don't seem to come along with it....
3
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started...
3
by: Ashok Kumar K | last post by:
Hi all, Where can I get some insight on using the __hook, __unhook, event_source and event_receiver for specifically COM events. The documentation given in MSDN is very minimal. I have the...
12
by: Riaan | last post by:
Hi Everybody, I created my own class with 2 methods (both public) in it. When I use the 1 method it works fine, as soon as I make a call to the other method, the program crashes. I removed all...
9
by: thiago777 | last post by:
Question details: VB .NET / threads / events / GUI Imagine the following situation: A method from object "A" creates "n" threads. Variables from these threads contains values that should...
0
by: thiago777 | last post by:
Hi! Im still trying to make my application work in an event-driven way. It had worked so far with my threads, but the problem Im having is only when modifying a GUI component from the event handler...
3
by: puzzlecracker | last post by:
What I currently have and request a suggestion to modularize it public sealed class Connection: BaseConnection{ //I have to process about 30 events public event Handler1=handler1; public...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.