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

Handling VB6 (ActiveX) events in C# app

I have a VB6 ActiveX EXE app that generates events that I would like
to handle in a C# application. The events in the VB app are defined
like:

Public Event SometingHappened(what As String)

and raised like so:

Public Sub EventNotification(ByVal what As String)
RaiseEvent SometingHappened(what)
End Sub

in the C# app I create the VB ActiveX object and add the C#
eventhandler:

oClass = new Project1.Class1Class();
oClass.SometingHappened += new
Project1.__Class1_SometingHappenedEventHandler(cla ss_event_handler);

and the eventhandler looks like:

private void class_event_handler(ref string what)
{
MessageBox.Show(what);
}

Everything builds OK in VS and when I run it and generate the event in
the VB ActiveX EXE nothing happens in the C# app. The event doesn't
seem to trigger the C# eventhandler. Any suggestions? or good examples
of trying to handle this situation?

Thanks Bill
Nov 16 '05 #1
2 5323
On 07 Jun 2004 01:57, Bill wrote:
I have a VB6 ActiveX EXE app that generates events that I would like
to handle in a C# application. The events in the VB app are defined
like:
<snip>oClass = new Project1.Class1Class();
oClass.SometingHappened += new
Project1.__Class1_SometingHappenedEventHandler(cl ass_event_handler);

and the eventhandler looks like:

private void class_event_handler(ref string what)
{
MessageBox.Show(what);
}

Everything builds OK in VS and when I run it and generate the event in
the VB ActiveX EXE nothing happens in the C# app. The event doesn't
seem to trigger the C# eventhandler. Any suggestions? or good examples
of trying to handle this situation?

Do you still have the reference to the VB8 object - i.e. does oClass still
exist? If not, then this can happen easily.

--
Simon Smith
simon dot s at ghytred dot com


Nov 16 '05 #2
>
Do you still have the reference to the VB8 object - i.e. does oClass still
exist? If not, then this can happen easily.


Yes.

To give a little more background...
I created a simple VB6 ActiveX.exe form with one button to generate
the event that I'm trying to trap in the C# application. In the button
click event handler I simply call EventNotification("test") which
raises the event (RaiseEvent SometingHappened(what)).

The C# application is a simple form with one button whose click
eventhandler calls a method on oClass to display a msgbox (in the VB6
app). That works fine! So I know that that object exists and works
properly calling from the C# app to the VB6 ActiveX app.

The only problem is that the events in the VB6 app are not triggering
the C# eventhandler.

Thanks Bill
Nov 16 '05 #3

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

Similar topics

3
by: klimontovich | last post by:
Hello! I'm trying to handle events raising by Microsoft ActiveX Spreadsheet control. I use following code to include this control into page: <object...
0
by: Sagaert Johan | last post by:
Hi I have a problem with an activeX control in a c# application, the events do not fire when i deploy the app to another PC When used in a web page, the events fire ok, so i guess the activeX...
5
by: Sagaert Johan | last post by:
hi I have the following problem: I have a C# application that uses an activeX . I installed the application and the NET 1.1 Runtimes on a clean pc When running the application i discover...
0
by: Kevin Ortman | last post by:
Hi all, I am wondering if the following is a known problem, and if there are any known solutions. Thanks in advance, Kevin Ortman
1
by: Felipe Garcia | last post by:
i have some old asp pages that uses activex controls. At the moment, my company are converting all of these old asp pages to asp.net. So my question is, there is a way to handle activex events in...
0
by: Itchy Ferret | last post by:
Yo I have exactly same problem as the below. Does anyone know a solution, pls? Thanks, Itchy. -------------------------------------------
1
by: kret | last post by:
Hi, this is my first post so first of all I would like to say hello :) Now getting to my problem. In my job I have to create an ActiveX control in .NET 1.1 that can be lunched from IE....
1
by: Jialiang Ge [MSFT] | last post by:
Hello Philippe, In addition to bruce's points, I'd suggest the KB article http://support.microsoft.com/kb/317392. It demonstrates how to host an ActiveX control in ASP.NET (for your first...
3
by: Almog Levin | last post by:
Hi everyone, I'm new to this forum and new to JS, I was hoping someone could help me. I've had some code, written by my predecessors in the company, in which some Javascript was handling events of a...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
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,...
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.