|
-
Aug 9th, 2005, 01:40 AM
#1
Thread Starter
New Member
Using OCX in C#
Hello Expoerts...
I can build and use ocx in visual basic 6. OCX made by visual basic6 can be use in C# form? Plz help me for this purpose.
-
Aug 9th, 2005, 02:38 AM
#2
Re: Using OCX in C#
You can add your ActiveX controls and COM components to the Toolbox by right-clicking and selecting Add/Remove Items. If your OCX file is not listed on the COM Components tab you can press the Browse button and navigate to it. You then check the objects you want to include in the Toolbox and press OK. You can then add your controls to a form like you would any other, which will add the required references to yuor project automatically. I've never developed for COM or ActiveX myself so I'm not sure, but I would imagine that you would have to register the controls in order to use them.
-
Aug 9th, 2005, 02:39 AM
#3
-
Aug 9th, 2005, 02:44 AM
#4
Thread Starter
New Member
Re: Using OCX in C#
jmcilhinney and MrPolite
My special Thanks Goes to you. I can add OCX file C# form. My question was OCX which i made in VB will work in C# perfectly?
-
Aug 9th, 2005, 02:55 AM
#5
Re: Using OCX in C#
C# cares nothing of the language used to create the classes it uses. It only cares about the interface that is exposed to it. In short, yes.
-
Aug 9th, 2005, 03:10 AM
#6
Thread Starter
New Member
Re: Using OCX in C#
jmcilhinney ....Thanksyou Very Much For ur Quick Reply.Take care
-
Aug 9th, 2005, 03:13 AM
#7
Thread Starter
New Member
Re: Using OCX in C#
jmcilhinney ....Thankyou Very Much For ur Quick Reply.Take care
-
Aug 9th, 2005, 01:37 PM
#8
Re: Using OCX in C#
ok I have one question in the same context too...
I've heard it's a "bad" idea to use COM components anymore? why do they say that? is it because they fear your app would not be so portable if you use COM? (If so, who cares. There's only MONO for linux so far.. )
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Aug 9th, 2005, 02:19 PM
#9
Frenzied Member
Re: Using OCX in C#
There's more complexity with using an ActiveX control from within C# (or VB.NET) that just using a .NET control.
When you add a reference to a COM object, Visual Studio automatically creates a Runtime Callable Wrapper (RCW). This (duh) is a wrapper around the COM object - your code actually calls the wrapper methods and not the COM object directly.
There have been some issues (well, one that I know of) with some ActiveX vendors where the automatically generated RCW did not work properly, so the vendor needed to create their own RCW and ship with the ActiveX control.
I'd prefer to use .NET components over COM objects if possible, as I've seen some things I don't like. Not sure if it's the architecture or just the nature of COM objects, but a lot of times there won't be superclasses/interfaces etc. Also, when trying to figure out the type of object at runtime, I've seen where sometimes the right type is returned, other times, it's named "__ComObject".
I have an app where the best solution was an ActiveX control, so I use COM objects if necessary, but I'd rather not if there's a good alternative.
Mike
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|