?
Solved

Adding a COM control in a .NET usercontrol -> How?

Posted on 2002-07-01
15
Medium Priority
?
358 Views
Last Modified: 2013-11-25
Hello,

I'm trying to place/add a COM control to a usercontrol in VB.NET.  The COM control is disabled in the toolbox and I even can't do it by using ' Inherits '.

The COM control is the scheduler control from DBI (Solutions:Schedule 4.0) (http://www.dbi-tech.com/show_products.asp?id_prod=3)

Any ideas...
0
Comment
Question by:KrisB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
15 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7121721
Rightclick on the toolbox -> Customize toolbox _> Select the right COM object.

You can only place a usercontrol on a form if the designer is closed.

CJ
0
 

Author Comment

by:KrisB
ID: 7121779
That's not the problem.
To place a usercontrol in a form is not a problem.

I can place all .Net controls but not an ActiveX / Com object on the usercontrol designer.

Help!
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7121796
Try compiling the usercontrol before placing the control.

CJ
0
Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

 

Author Comment

by:KrisB
ID: 7121819
The problem stays, just can't add the control to the usercontrol.

To place the control on a form, that's not a problem.
I suppose that .Net usercontrols can't cooperate with com / activeX controls?

0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7121890
They should. It works for any COM object for me... not sure about that specific control. Will check.
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7121955
- I downloaded the trial version.
- Started VS.Net (Enterprise Architect)
- Made a new VB.Net Application project
- Added a usercontrol to the project
- Adjusted my toolbox with the new control (ctSchedulerCtrl)
- placed the control on my usercontrol

and it all worked.

What version are you using?
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7121962
I can also Inherit from.

CJ
0
 

Author Comment

by:KrisB
ID: 7121994
Damm, (Godver in't nederlands)

I've just tried several other com controls, nope!

I also use Entreprise Architect

Versions:
Development Environment 1.0.9466
Net Framework 1.0.37.05

i've installed the first service pack of DotNet
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7121997
Then you have exactly the same configuration as I have!!!!

What if you reboot and start off with a clean windows configuration? Just wondering because all should be okay.

CJ (CJ in het Nederlands ;-)
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7122041
Try hardcoding the control. Add following code to the InitializeComponent procedure:

        Me.AxctSchedule1 = New AxCTSCHEDULELib.AxctSchedule()
        CType(Me.AxctSchedule1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'AxctSchedule1
        '
        Me.AxctSchedule1.Location = New System.Drawing.Point(24, 80)
        Me.AxctSchedule1.Name = "AxctSchedule1"
        Me.AxctSchedule1.OcxState = CType(resources.GetObject("AxctSchedule1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.AxctSchedule1.Size = New System.Drawing.Size(440, 248)
        Me.AxctSchedule1.TabIndex = 0
0
 

Author Comment

by:KrisB
ID: 7122120
Yes!  It works!
I've just used regclean from Norton Utilities.
Problaby som old 'stuff' in my registry

Thanks!!!

But now I have a more difficult problem, I want the same thing in a component class!!!

0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7122128
Probably yea :-)

What exactly do you want?
0
 

Author Comment

by:KrisB
ID: 7122160
Well,

I added a new component class
Opening the souce code of
Disable Inherits System.ComponentModel.Component
Inherits AxCTSCHEDULELib.AxctSchedule

No errors...

But when I open the compent class design...
"Property accessor 'PreColumnType'on ccSched threw the following exception 'Catastrophic Failure' ...

The builder can't make a resx file...
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 1050 total points
ID: 7123968
Just make it
Inherits AxCTScheduleLib.XxctSchedule

Not the other line also.

CJ
0
 

Author Comment

by:KrisB
ID: 7124160
Thanks a lot CJ_S for your comments.

I will use the usercontrol with the activeX control.

I have already another question...
0

Featured Post

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question