473,509 Members | 6,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create an ActiveX Control in .NET and use it under VB6

Hello

Is it Possible to build an ActiveX Control with NET ?

I want to take a NET UserControl and use it with VB6.

I found a solution how to embbed a NET UserControl into
a WebPage (Like it was possible with ActiveX Control)

http://www.vbdotnetheaven.com/Code/Jun2003/2067.asp

Maybe that is the halve way.

Any Idea ?


Nov 20 '05 #1
4 1416
* "Captain Chaos" <no****@nospam.com> scripsit:
Is it Possible to build an ActiveX Control with NET ?
No.
I want to take a NET UserControl and use it with VB6.

I found a solution how to embbed a NET UserControl into
a WebPage (Like it was possible with ActiveX Control)

http://www.vbdotnetheaven.com/Code/Jun2003/2067.asp

Maybe that is the halve way.


"Forget it."

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
That's not the answer I want to hear :-)

I am 1000% sure there may be a proper solution
but I only know a very dirty one that I don't like......

For example I could create a NET Window, put the NET Control in it.
The create a COM Interface.
Then Create a VB6 ActiveX Control an call the COM Interface.
Then open the Window, getting the Windows Handle of the Control
and place the Control via Windows API (setParent) in the VB6 ActiveX
Control.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im Newsbeitrag
news:uq**************@TK2MSFTNGP12.phx.gbl...
* "Captain Chaos" <no****@nospam.com> scripsit:
Is it Possible to build an ActiveX Control with NET ?


No.
I want to take a NET UserControl and use it with VB6.

I found a solution how to embbed a NET UserControl into
a WebPage (Like it was possible with ActiveX Control)

http://www.vbdotnetheaven.com/Code/Jun2003/2067.asp

Maybe that is the halve way.


"Forget it."

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
Ok, i found some kind of solution myself:

First Create a COM Class with DOT NET.
Menu "Project" - "AddNew Item" - Com Class.

But the Code from there into your UserControl

It look something like this the:
<ComClass(UserControl1.ClassId, UserControl1.InterfaceId,
UserControl1.EventsId)> _
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "4E194D65-C09C-4378-B47F-CAAF521EB8EC"
Public Const InterfaceId As String =
"F9913483-3444-4989-A4D1-F1D4D23955BA"
Public Const EventsId As String = "F05903BF-31A7-47F6-AF5F-67C230D1F172"
#End Region

Windows Form Designer generated code

Public Sub Test()

End Sub

End Class

If you compile the whole thing you there is a *.TLB File created.

Now start VB6:

Make a reference to the TLB File.

Then in the VB 6 User Control you can load your DOT NET Control Dynamicly:

Dim vlob_UserCtrl As Object

Set vlob_UserCtrl = Controls.Add("ClassLibrary5.UserControl1", "HeadCtrl")
vlob_UserCtrl.Left = 0
vlob_UserCtrl.Top = 0
vlob_UserCtrl.ZOrder 0
vlob_UserCtrl.Visible = True
ClassLibrary5.UserControl1 = Namespace and Controlname of the DOT Net
Control

"Captain Chaos" <no****@nospam.com> schrieb im Newsbeitrag
news:bt*************@news.t-online.com...
Hello

Is it Possible to build an ActiveX Control with NET ?

I want to take a NET UserControl and use it with VB6.

I found a solution how to embbed a NET UserControl into
a WebPage (Like it was possible with ActiveX Control)

http://www.vbdotnetheaven.com/Code/Jun2003/2067.asp

Maybe that is the halve way.

Any Idea ?

Nov 20 '05 #4

In Addition:

To Handle Events and Set/Get Properties use Code like this:
Dim vlob_UserCtrl As Object
Dim WithEvents vlob_UserCtrl2 As ClassLibrary5.UserControl1

Private Sub Command1_Click()

Set vlob_UserCtrl = Controls.Add("ClassLibrary5.UserControl1", "HeadCtrl")
vlob_UserCtrl.Left = 0
vlob_UserCtrl.Top = 0
vlob_UserCtrl.Height = 100
vlob_UserCtrl.ZOrder 0
vlob_UserCtrl.Visible = True

Set vlob_UserCtrl2 = vlob_UserCtrl.object

'With vlob_UserCtrl2 you can now handle the Events and set/Get
Properties/Call Methodes aso.

End Sub
"Captain Chaos" <no****@nospam.com> schrieb im Newsbeitrag
news:bt*************@news.t-online.com...
Hello

Is it Possible to build an ActiveX Control with NET ?

I want to take a NET UserControl and use it with VB6.

I found a solution how to embbed a NET UserControl into
a WebPage (Like it was possible with ActiveX Control)

http://www.vbdotnetheaven.com/Code/Jun2003/2067.asp

Maybe that is the halve way.

Any Idea ?

Nov 20 '05 #5

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

Similar topics

10
3868
by: Andrew Chalk | last post by:
I have an ASP 3.0 page that contains an ActiveX control that I wrote in VC++ v6.0. Under Visual Interdev I can debug the ASP code just fine. However, when I get to an ASP line that references my...
6
3678
by: Vinay | last post by:
Hi all, Can we create an ActiveX (.OCX) control in ATL project type? Is project type for creation of .OCX file can only be ActiveX MFC type? If yes, Could you suggest me some Links? My...
4
2420
by: Mr Seth T | last post by:
Hey, I have spent several days trying to find out how to do something, and i don't know if I am blind or what, but I can not find it. I am developing a web app and I need it to run an activex...
1
2255
by: JUN | last post by:
Hi all, I use c# to create ActiveX control, and works under IE browser. Now, i add a "Save" procedure for this ActiveX,but in Client calling ,it not works. the save procedure: public...
0
7237
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,...
0
7347
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
7416
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...
1
7073
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...
1
5062
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
4732
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
3218
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
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.