473,786 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 SometingHappene d(what As String)

and raised like so:

Public Sub EventNotificati on(ByVal what As String)
RaiseEvent SometingHappene d(what)
End Sub

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

oClass = new Project1.Class1 Class();
oClass.Someting Happened += new
Project1.__Clas s1_SometingHapp enedEventHandle r(class_event_h andler);

and the eventhandler looks like:

private void class_event_han dler(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 5358
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.Class1 Class();
oClass.Sometin gHappened += new
Project1.__Cla ss1_SometingHap penedEventHandl er(class_event_ handler);

and the eventhandler looks like:

private void class_event_han dler(ref string what)
{
MessageBox.Sho w(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 EventNotificati on("test") which
raises the event (RaiseEvent SometingHappene d(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
19033
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 classid="clsid:0002E551-0000-0000-C000-000000000046" id="Spreadsheet1""> </object>
0
1084
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 registration is ok. On my devlopment PC i do not have this problem, all events fire as expected.
5
1632
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 that the activeX events do not fire. I installed VS NET 2003 on that machine.(in an attempt to start debuggging) Now the activeX events fire again (application works as expected ).
0
1112
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
2422
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 the asp.net code behind. <SCRIPT FOR="WEBDECODER1" EVENT="onaction" LANGUAGE="VBScript"> dim myaction dim sig, format, captureTime set myaction= action1 sig = myaction.Signature myform.submit </SCRIPT>
0
1310
by: Itchy Ferret | last post by:
Yo I have exactly same problem as the below. Does anyone know a solution, pls? Thanks, Itchy. -------------------------------------------
1
8301
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. This part is done but next requirement is that after closing ActiveX I have to redirect parent page to location X or Y depending on how the
1
1937
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 question), and points out that ActiveX control is a pure client-side control, the server-side code cannot access this control (for your second question). Server-side code can access only server controls, which are the controls that are listed on the Web...
3
1870
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 VB6 object using the FOR/EVENT syntax. I was asked to replace the VB6 with an ATL object. I did, with the same class Id and everything, but the Javascript no longer registers for the event. The object methods are called, but the events are not...
0
9650
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
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10110
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
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7515
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
6748
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();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.