Solved

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

Posted on 2002-07-01
15
354 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

816 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

10 Experts available now in Live!

Get 1:1 Help Now