I have a pretty complex control which use to be a C# windows form that I am
trying to make into a control that can be dragged onto a VB6 form.
I was able to make it into a com class that I could then go to VB6 and add
the reference and call the object there without any problems.
When I try to make it into a UserControl, I get it to build and it registers
itself during the build with no errors BUT I can not add the dll to the vb6
project. I can add the dll to another C# project and all the form
(usercontrol) works as it should with the grid and toolbar buttons doing
their thing as planned.
below is the top section of the class diff.
The contructor doesn't do anything but the InitializeCompo nent() call.
thanks for any assistance.
Dennis
using interop = System.Runtime. InteropServices ;
namespace TASAMS
{
[interop.ProgId( "TimeLineContro l"),
interop.Guid("1 24B9B07-35A7-4c72-B04B-3A04E42F1E07"),
interop.ClassIn terface(interop .ClassInterface Type.AutoDispat ch),
interop.ComVisi ble(true)]
public class TimeLineControl : System.Windows. Forms.UserContr ol
{
....
} 4 9299
Hi Dennis,
You cannot turn a C# user control to an OCX - this possibility, as far as I
remember, was considered and partially implemented in early beta versions of
the Framework, but later Microsoft decided not to support it in the release
version. Still, you have a workaround (BTW it is widely used by developers
writing add-ins for VS .NET) - the so-called shim control. It is a free
small ActiveX control provided by Microsoft (not sure where to look for it
on the Microsoft website but I'm sure there are even several versions in the
"Files" section of this group: http://groups.yahoo.com/groups/vsnetaddin)
The ActiveX has a couple of public methods designed to tell the ActiveX
which class from which assembly to host inside it. So you drag the ActiveX
to a VB6 form and then invoke its HostUserControl method - and voila, you
have a .NET control in your VB6 app.
--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx
"Dennis Burdett" <de*******@hotm ail.com> wrote in message
news:O4******** ******@TK2MSFTN GP15.phx.gbl... I have a pretty complex control which use to be a C# windows form that I am trying to make into a control that can be dragged onto a VB6 form.
I was able to make it into a com class that I could then go to VB6 and add the reference and call the object there without any problems.
When I try to make it into a UserControl, I get it to build and it registers itself during the build with no errors BUT I can not add the dll to the vb6 project. I can add the dll to another C# project and all the form (usercontrol) works as it should with the grid and toolbar buttons doing their thing as planned.
below is the top section of the class diff.
The contructor doesn't do anything but the InitializeCompo nent() call.
thanks for any assistance. Dennis
using interop = System.Runtime. InteropServices ;
namespace TASAMS
{
[interop.ProgId( "TimeLineContro l"),
interop.Guid("1 24B9B07-35A7-4c72-B04B-3A04E42F1E07"),
interop.ClassIn terface(interop .ClassInterface Type.AutoDispat ch),
interop.ComVisi ble(true)]
public class TimeLineControl : System.Windows. Forms.UserContr ol
{
....
}
thanks Dmitriy,
I have been trying to figure out how to do this most of the day and can get
it to build (at least the shim part) and I am then able to add the new dll
to the VB6 project form BUT I guess I am just not understanding what or how
to make the changes my code to get it to actually add my UserControl to the
host shim dll so it will run my stuff within vb.
Dennis
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ex******** ******@TK2MSFTN GP14.phx.gbl... Hi Dennis,
You cannot turn a C# user control to an OCX - this possibility, as far as
I remember, was considered and partially implemented in early beta versions
of the Framework, but later Microsoft decided not to support it in the
release version. Still, you have a workaround (BTW it is widely used by developers writing add-ins for VS .NET) - the so-called shim control. It is a free small ActiveX control provided by Microsoft (not sure where to look for it on the Microsoft website but I'm sure there are even several versions in
the "Files" section of this group: http://groups.yahoo.com/groups/vsnetaddin)
The ActiveX has a couple of public methods designed to tell the ActiveX which class from which assembly to host inside it. So you drag the ActiveX to a VB6 form and then invoke its HostUserControl method - and voila, you have a .NET control in your VB6 app.
-- Sincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx
"Dennis Burdett" <de*******@hotm ail.com> wrote in message news:O4******** ******@TK2MSFTN GP15.phx.gbl...I have a pretty complex control which use to be a C# windows form that I
am trying to make into a control that can be dragged onto a VB6 form.
I was able to make it into a com class that I could then go to VB6 and
add the reference and call the object there without any problems.
When I try to make it into a UserControl, I get it to build and it registers itself during the build with no errors BUT I can not add the dll to the vb6 project. I can add the dll to another C# project and all the form (usercontrol) works as it should with the grid and toolbar buttons doing their thing as planned.
below is the top section of the class diff.
The contructor doesn't do anything but the InitializeCompo nent() call.
thanks for any assistance. Dennis
using interop = System.Runtime. InteropServices ;
namespace TASAMS
{
[interop.ProgId( "TimeLineContro l"),
interop.Guid("1 24B9B07-35A7-4c72-B04B-3A04E42F1E07"),
interop.ClassIn terface(interop .ClassInterface Type.AutoDispat ch),
interop.ComVisi ble(true)]
public class TimeLineControl : System.Windows. Forms.UserContr ol
{
....
}
Dennis,
As far as I remember, this should look like something like this:
Sub Form_Load
Dim objUserControl As Object
Set objUserControl =
objShimControl. HostUserControl ("MyNamespace.M yControl", "MyAssembly ,
Version=1.0.0.0 , Culture=Neutral , PublicKeyToken= null")
End Sub
--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx
"Dennis Burdett" <de*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. thanks Dmitriy,
I have been trying to figure out how to do this most of the day and can get it to build (at least the shim part) and I am then able to add the new dll to the VB6 project form BUT I guess I am just not understanding what or how to make the changes my code to get it to actually add my UserControl to the host shim dll so it will run my stuff within vb.
Dennis
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message news:ex******** ******@TK2MSFTN GP14.phx.gbl... Hi Dennis,
You cannot turn a C# user control to an OCX - this possibility, as far as I remember, was considered and partially implemented in early beta versions of the Framework, but later Microsoft decided not to support it in the release version. Still, you have a workaround (BTW it is widely used by developers writing add-ins for VS .NET) - the so-called shim control. It is a free small ActiveX control provided by Microsoft (not sure where to look for it on the Microsoft website but I'm sure there are even several versions in the "Files" section of this group: http://groups.yahoo.com/groups/vsnetaddin)
The ActiveX has a couple of public methods designed to tell the ActiveX which class from which assembly to host inside it. So you drag the ActiveX to a VB6 form and then invoke its HostUserControl method - and voila, you have a .NET control in your VB6 app.
-- Sincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx
"Dennis Burdett" <de*******@hotm ail.com> wrote in message news:O4******** ******@TK2MSFTN GP15.phx.gbl... >I have a pretty complex control which use to be a C# windows form that I am > trying to make into a control that can be dragged onto a VB6 form. > > I was able to make it into a com class that I could then go to VB6 and add > the reference and call the object there without any problems. > > When I try to make it into a UserControl, I get it to build and it > registers > itself during the build with no errors BUT I can not add the dll to the > vb6 > project. I can add the dll to another C# project and all the form > (usercontrol) works as it should with the grid and toolbar buttons > doing > their thing as planned. > > below is the top section of the class diff. > > The contructor doesn't do anything but the InitializeCompo nent() call. > > thanks for any assistance. > Dennis > > using interop = System.Runtime. InteropServices ; > > namespace TASAMS > > { > > [interop.ProgId( "TimeLineContro l"), > > interop.Guid("1 24B9B07-35A7-4c72-B04B-3A04E42F1E07"), > > interop.ClassIn terface(interop .ClassInterface Type.AutoDispat ch), > > interop.ComVisi ble(true)] > > public class TimeLineControl : System.Windows. Forms.UserContr ol > > { > > .... > > } > > > >
Thanks Dmitriy
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ey******** ******@TK2MSFTN GP09.phx.gbl... Dennis,
As far as I remember, this should look like something like this:
Sub Form_Load Dim objUserControl As Object Set objUserControl = objShimControl. HostUserControl ("MyNamespace.M yControl", "MyAssembly , Version=1.0.0.0 , Culture=Neutral , PublicKeyToken= null") End Sub
-- Sincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx
"Dennis Burdett" <de*******@hotm ail.com> wrote in message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. thanks Dmitriy,
I have been trying to figure out how to do this most of the day and can get it to build (at least the shim part) and I am then able to add the new
dll to the VB6 project form BUT I guess I am just not understanding what or how to make the changes my code to get it to actually add my UserControl to the host shim dll so it will run my stuff within vb.
Dennis
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om>
wrote in message news:ex******** ******@TK2MSFTN GP14.phx.gbl... Hi Dennis,
You cannot turn a C# user control to an OCX - this possibility, as far
as I remember, was considered and partially implemented in early beta
versions of the Framework, but later Microsoft decided not to support it in the release version. Still, you have a workaround (BTW it is widely used by developers writing add-ins for VS .NET) - the so-called shim control. It is a free small ActiveX control provided by Microsoft (not sure where to look for it on the Microsoft website but I'm sure there are even several versions
in the "Files" section of this group: http://groups.yahoo.com/groups/vsnetaddin) The ActiveX has a couple of public methods designed to tell the ActiveX which class from which assembly to host inside it. So you drag the ActiveX to a VB6 form and then invoke its HostUserControl method - and voila,
you have a .NET control in your VB6 app.
-- Sincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx
"Dennis Burdett" <de*******@hotm ail.com> wrote in message news:O4******** ******@TK2MSFTN GP15.phx.gbl... >I have a pretty complex control which use to be a C# windows form that
I am > trying to make into a control that can be dragged onto a VB6 form. > > I was able to make it into a com class that I could then go to VB6
and add > the reference and call the object there without any problems. > > When I try to make it into a UserControl, I get it to build and it > registers > itself during the build with no errors BUT I can not add the dll to
the > vb6 > project. I can add the dll to another C# project and all the form > (usercontrol) works as it should with the grid and toolbar buttons > doing > their thing as planned. > > below is the top section of the class diff. > > The contructor doesn't do anything but the InitializeCompo nent()
call. > > thanks for any assistance. > Dennis > > using interop = System.Runtime. InteropServices ; > > namespace TASAMS > > { > > [interop.ProgId( "TimeLineContro l"), > > interop.Guid("1 24B9B07-35A7-4c72-B04B-3A04E42F1E07"), > > interop.ClassIn terface(interop .ClassInterface Type.AutoDispat ch), > > interop.ComVisi ble(true)] > > public class TimeLineControl : System.Windows. Forms.UserContr ol > > { > > .... > > } > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: S Guiboud |
last post by:
I want to subclass the System.Web.UI.UserControl to make a
common control for my site. Then, when I create a new
UserControl from the Visual Studio I changed the base
class System.Web.UI.UserControl to my UserControl class
(a.k.a MyUserControl).
MyUserControl is only a .cs file with a class inheriting
from System.Web.UI.UserControl.
But, when I try to view the control in the Visual Studio
designer it always pop me a window asking me if I...
|
by: Michael Evanchik |
last post by:
Tying not to spaghetti code which seems to be easy to do in .net, im
trying to do my main .net html in index.aspx, use repeated .net html
in an .ascx files and all code im doing in .vb code behind files.
I have no problem using my .vb code behind file for my .aspx pages i
just have to say <%@ Page Language="vb" Inherits="myCode"
src="index.vb" %> in my aspx file and use Inherits Page in my .vb code
behind file and everything is cool
...
|
by: Henri |
last post by:
I guess I could do that with an .ascx UserControl file using
Page.LoadControl(), but as I want to render a complete page inside a mail
body, loading an .aspx might be nicer...
Any suggestion?
Henri
|
by: Sascha |
last post by:
Hi there,
I searched carefully through the web before finally deciding to post
this message, because I could not find a solution for my problem.
Hopefully someone will have a hint or explanation for me! I apologize
for the length of this posting, but I wanted to make sure that I get an
answer other than "Hey man, just use LoadControl!", because this is not
what I want.
The Task: Isolate a collection of web forms which are created as
|
by: Philipp Lenz |
last post by:
I'm very confused about how this works, all the tutorials out there
show me how to apply a skin to a webcontrol, but I want to know how
I can access the components of a control....for example:
I have a usercontrol, the ascx is defined like this:
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="Test.ascx.cs" Inherits="Spin.Test" %>
<asp:Panel ID="Panel1" runat="server" Height="243px" Width="350px">
| |
by: urs |
last post by:
Two days ago, I built an ASP.NET 2.0 application and published it on a
shared IIS 6 Web server. After publishing, and during the whole day, it
worked fine.
The server remained untouched since. Today, I wanted to access the home
page of the application again with a browser. But instead of the proper
page, I just got an ugly message:
Server Error in '/' Application.
|
by: Joe |
last post by:
Hello All:
Do I have to use the LoadControl method of the Page to load a UserControl?
I have a class which contains three methods (one public and two private).
The class acts as a control server. It "serves" back the required control
(either WebControl or UserControl) based on the contents of an xml file. The
code in the webform places each control in a TableCell.
My problem is that the control server works as far as returning the...
|
by: oliver |
last post by:
QUESTION: How to access an object embedded in a UserControl through
Javascript file?
Another way to ask this question: How to execute script from a UserControl,
accessing other objects in that UserControl? (Script attached to, and
executed by, a UserControl embedded server control can ‘see’ the UserControl
through the root document architecture. How to get the script to execute and
‘see’ other server controls in the...
|
by: Arpan |
last post by:
I have created the following UserControl (the file is named
LoginForm.ascx):
<script language=VB runat="server">
Public UName As String
Public UPwd As String
Public BColor As String
Public Sub btnSubmit(ByVal obj As Object, ByVal ea As EventArgs)
lblMessage.Text = "UserName : " & uid.Text & "<br>Password : "
|
by: Rolf Welskes |
last post by:
Hello,
I want to partial cache by using a UserControl.
Now I have a file dependency.
In msdn I see it is not possible to do it the same way as in a page.
The only information is to create a file dependency and assign it to
Dependency property.
|
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,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |