473,471 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why event doesnt fire in .NET object from VBS?


using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

namespace DEMONS
{

[ComVisible(false)]
public delegate void TestEventHandler();
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]
public interface ControlEvents
{
//[DispIdAttribute(0x60020000)]
void OnBeforeStartTest();
}

[
ClassInterface(ClassInterfaceType.AutoDispatch),
ComSourceInterfaces(typeof(ControlEvents))
]
public class Demo
{
public event TestEventHandler OnBeforeStartTest;
public void TEST()
{
Console.WriteLine("TEST()");

if (OnBeforeStartTest != null)
OnBeforeStartTest();
}
}
}
VBS:

[code:1:d720d2858a]
sub OnTest2()
msgbox "VBSCRIPT OnTest"
end sub

sub obj_OnBeforeStartMigration()
msgbox "VBSCRIPT OnTest"
end sub

set obj = createobject("DEMONS.Demo")
set obj.OnBeforeStartTest = GetRef("OnTest2")
obj.TEST
[/code:1:d720d2858a]

obj.TEST works fine (if to comment upper string). But when I leave it
uncommented i receive
Microsoft VBScript runtime error: Object doesn't support this property
or method: 'obj.OnBeforeStartTest'

Whats wrong to my code - VBS and .NET?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #1
0 783

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

Similar topics

21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
3
by: James Dunkerley | last post by:
Hi, I am trying to create a class which downloads a web page in the background and then raises an event in the original thread in which it was created. This class is going to be the basis of a...
21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
4
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up ...
21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
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...
0
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...
0
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 ...

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.