Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi. The other day I started VB.NET and tried to Add a reference to a COM component, a few controls I created in VB6... then...

 

1. It didnt show a decent error, it just did nothing.

2. After checking all the screen I saw in a little dockable window in the low part of the IDE and error about some error with oleaut.

 

Let's put it this way. How can I use and old ActiveX component created with VB6 (in my case) with VB.NET? :confused:

Posted
Hi again. Just to mention... First, There is no real NEED of doing this, it's just that I wanted to know if it was possible and Second, I supposed someone will have that problem with a very big and complicated component that dont want to recreate. Well thanks for anything.
Posted

You should be able to drag and drop ActiveX controls onto your .Net Form in the Designer as with any control. It will work the the COM Interop and so will run a bit slower, and it's generally better to use a .Net control instead of a COM ActiveX control... but it should work fine.

 

Which ActiveX control are you trying to use? It sounds like it might be a control that comes with VB6?? I think it would be better to use the equivalent .Net control instead. Which control is it and maybe we can help...

Posting Guidelines

 

Avatar by Lebb

Posted

Well it is a control a made with Visual Basic 6. It has nothing special, but perhaps I should create a new one with VB6, totally random to test if I have some problem. I'll let you know.

 

By the way... my VS.NET pre-release, has this great control StripMenu but it has a lot of bugs, I mean the .NET control doesnt work fine! What about it?

Posted

Ok, so you have your own UserControl that you made with VB6 and wish to use it in VB.Net? I know it doesn't sound like fun to re-do your control from scratch, but it does sound like it's worth learning how to make a UserControl in .Net instead and re-make it. I've never done it myself, but reading about it it looks pretty straight forward, and very parallel to the procedure used in VB6.

 

If you don't re-do it, I think you're talking about having to register your ActiveX control as well as whatever controls your ActiveX is using? I could be wrong about that, but, yes, at a minimum you could try making a new, very-simple ActiveX control and see if it works. It should, but a complex one may have special issues. Again, I'd seriously think about learning how to make a UserControl "the .Net way".

 

As for the StipMenu control, I don't have any experience with that. You probably should post your question regarding the StripMenu within the .Net General Forum.

 

Hope this helps!

Mike

Posting Guidelines

 

Avatar by Lebb

Posted

OK... about the StripMenu Ill find help later... and I sure want to learn the ".NET way"... as I said there is no real need to do this... I just wanted to know if it was possible to share a VB6 COM Object with VB.NET... Thanks.

:)

Posted

In theory, yes absolutely. The COM Interop makes this possible and generally does so seemlessly. That said, it is still generally best to stay 100% within .Net if that is possible/reasonable, and your custom ActiveX control is not behaving properly. :(

 

So where you go from here, I'm not sure, but my advice would be to re-do it in .Net if that is at all possible/reasonable. If you wish to fix it "in place", I think you have to make sure that your ActiveX control is registered properly as well as the various sub-controls that your ActiveX UserControl is utilizing.

 

But since it works on VB6, I would guess that they are? So it remains a mystery as to why it would fail in .Net then... but if it is a complex control, as you stated, then it will likely be a lot of work to track down where the COM Interop is failing you here. :(

Posting Guidelines

 

Avatar by Lebb

Posted
Ok. I agree with you, .NET is the way to go... I just felt curious. You know, my control in VB made extensive use of the Windows API and subclassing the container form of the object, and other cool stuff too. I wonder now. . . (Im not very advanced in .NET) but how much different is programming a UserControl in .NET that what it was in VB6. I understand in VB6 all of it was pure disguised COM, now in .NET im not very sure.
Posted

I don't really know myself. The basics look pretty much the same, bet I can tell (without ever having actually done it.) As for Subclassing I don't know, probably essentially the same, I would guess, but I've not gone there, so I just don't know.

 

As you know, subclassing with a UserControl.OCX in VB6 is a touchy business; either you have to be very careful how you hook and unhook, or probably best to use weak pointers... My guess is that the same exact principles may apply in .Net OCX's. However the built-in .Net UserControl events may be more suitable to simple Hook-until-terminated sort of approach, I just don't know. A lot of .Net has been improved over old VB6, recognizing problems, etc., so they may have made this issue less touchy.

 

I think you'll have to go and give it a try! :)

Posting Guidelines

 

Avatar by Lebb

Posted

Oh. H e l l Yeah!! It looks very interesting. Actually the whole UserControl programming is great. (I have heard that was Alan Cooper who initially came on with the Idea, what an Idea!!)

 

Yes .NET adds so many facilities with all those extra events that VB needed subclassing to go around, Im happy about that, I suppose I will need subclassing when a proble arises. Cool by now.

 

By the way the control Ive bee talking all along is a Splitter Control, just like the one that came with my VS.NET. (well ten-times less cooler)... but anyway I havent been able to make it work. (I should keep trying but forgetting the past and getting to work the new tech sure seems more exciting!!)

 

Note: Go learn it yourself so you can explain me later. gg (kddin)

Posted

Ok, just had a look, yeah that Splitter Control does look very cool, eh? :cool:

 

I will get into UserControls at some point, I just haven't gotten to it yet. When I'm ready, I'll be bugging you for a lession, I think. ;)

Posting Guidelines

 

Avatar by Lebb

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...