Solved

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

Posted on 2002-07-01
15
351 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
Comment Utility
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
Comment Utility
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
Comment Utility
Try compiling the usercontrol before placing the control.

CJ
0
 

Author Comment

by:KrisB
Comment Utility
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
Comment Utility
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
Comment Utility
- 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
Comment Utility
I can also Inherit from.

CJ
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:KrisB
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Probably yea :-)

What exactly do you want?
0
 

Author Comment

by:KrisB
Comment Utility
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
Comment Utility
Just make it
Inherits AxCTScheduleLib.XxctSchedule

Not the other line also.

CJ
0
 

Author Comment

by:KrisB
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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 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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

18 Experts available now in Live!

Get 1:1 Help Now