Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB 6.0 >>> VB.NET / October 2005

Tip: Looking for answers? Try searching our database.

Problem accessing VB6 OCX file from VB.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 14 Sep 2005 13:42 GMT
Hello:
I am trying to access a VB6 OCX file (with many important methods in it
created by me) using VB.NET.

Let me tell you what I have done to access the methods.
I started with registering the OCX file using regsvr32 and registering
the ocx file. I tried to create an object using the NEW keyword but was
giving me an error saying that the method NEW was private and I cannot
access it outside.

So I upgraded the old VB6 project to .NET and it created a new .dll
file with a "New" method in it. So I could declare an object for that.
But whenever I start trying to access any methods in the OCX file I get
an exception saying "InvalidActiveXStateException". If I debug step by
step, I dont get that exception and but I dont get correct results from
the methods.

"Register for COM Interop" option is selected in the properties and I
also registered the new .dll file using regasm.But the methods still
donot work.

Please Help
Thanks in advance.
Ken Halter - 06 Oct 2005 20:34 GMT
> Hello:
> I am trying to access a VB6 OCX file (with many important methods in it
[quoted text clipped - 5 lines]
> giving me an error saying that the method NEW was private and I cannot
> access it outside.

VB6 guy here so I'm no expert but.... to add VB ocx's to .Net's toolbox,
right click the tool box, select Add/Remove Items, when the dialog pops up,
click on the COM Components tab, wait 10 minutes for the dialog to refresh,
scroll down and find that your ocx isn't there (like it should be), click
the Browse button and browse to the ocx. It should show in the toolbox and,
I imagine, let you do your remaining chores.

Signature

Ken Halter - MS-MVP-VB (Classic) - http://www.vbsight.com
Please keep all discussions in the groups..


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.