Solved

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

Posted on 2002-07-01
15
352 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
  • 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
 

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 350 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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 those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now