Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Net Activex controls in VFP
Message
General information
Forum:
ASP.NET
Category:
ActiveX controls
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01293162
Message ID:
01293166
Views:
18
This message has been marked as the solution to the initial question of the thread.
In the namespace block of your control code define delegates for the events like this:

namespace DotNetControl
{
[ComVisible(false)]
public delegate void MyClick1EventHandler();
[ComVisible(false)]
public delegate void MyClick2EventHandler();
...

Define a public interface to expose the events of your UserControl class in Visual FoxPro like this (Notice the Guid, InterfaceType, and DispId attributes - you'll need to generate your own Guid):

[GuidAttribute("F11EC17C-59E1-42D1-AE96-712AB79F20AB")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
public interface ControlEvents
{
[DispIdAttribute(1)]
void MyClick1();
[DispIdAttribute(2)]
void MyClick2();
}

The beginning of your class definition should look something like the following (Notice the Guid, ProgId, ClassInterface and ComSourceInterfaces - generate your own Guid and make sure the parameter sent to typeof is the same as the public interface you created) :

[Guid("2DEFE6F9-6738-454C-BEF1-CF944E7F5F06")]
[ProgId("DotNetControl.DotNetToolbar")]
[ClassInterface(ClassInterfaceType.AutoDual), ComSourceInterfaces(typeof(ControlEvents))]
public partial class DotNetToolbar : UserControl
{
public DotNetToolbar()
{
InitializeComponent();
}
...

Specify your events


event DotNetControl.MyClick1EventHandler MyClick1;
event DotNetControl.MyClick2EventHandler MyClick2;
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform