Solved

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

Posted on 2002-07-01
15
355 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
How our DevOps Teams Maximize Uptime

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

 

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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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