Automation Error Vb6 .net
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up VB6 Automation Error on Calls to .NET 3.5 Assemblies After the First Calls up vote 0 down vote favorite Some of the sources I've checked already: http://www.experts-exchange.com/Programming/Languages/.NET/Visual%5FBasic.NET/Q%5F23359339.html http://mygreenpaste.blogspot.com/2006/03/net-framework-20-configuration-tool.html http://support.microsoft.com/kb/186063 I'm busy developing .NET modules that will hook into our existing VB6 code. I've created a test VB6 project from which to launch the new code which comprises of a form with a button, and on the button's click event is Dim launcher As New VB6InteropLaunchPad.launcher launcher.FormTypeEnum = FormTypeEnum_MySpecificForm launcher.launchAppropriateForm It is successful the first time I click the button. However, if I click the button again, I get the following error: Run-time error '-2146233079 (80131509)': Automation Error Subsequent calls to the .NET code fail with the same error message unless I close and restart the IDE. If I compile the VB6 project to an EXE the same thing happens. I have to close the EXE and run it again to be able to access the .NET code. I've tried the suggestion on http://support.microsoft.com/kb/186063 and did the following: Option Explicit ' http://support.microsoft.com/kb/186063 Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000 Private Declare Function FormatMessage Lib "kernel32" Alias _ "FormatMessageA" (ByVal dwFlags As Long, lpSource As Long, _ ByVal dwMessageId As Long, ByVal dwLanguageId As Long, _ ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Any) _ As Long Private Function MessageText(lCode As Long) As String Dim sRtrnCode As String Dim lRet As Long sRtrnCode = Space$(256) lRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0&, lCode, 0&, _ sRtrnCode, 256&, 0&) If lRet > 0 Then MessageText = Left(sRtrnCode, lRet) Else MessageText = "Error not found." End If End Function On Error GoTo errHandler Dim launcher As New VB6Inte
Ask a Question Need help? Post your question and get tips & solutions from a community of 418,436 IT Pros & Developers. It's quick & easy. VB6 automation error trying to use a COM-exposed C# DLL P: n/a Tremendo Hi, I have two PCs: PC1: Visual Studio 2005 (including .NET framework 2.0. PC2: Visual Studio 6 (using Visual Basic 6) + .NET framework 2.0 installed separately. On PC1 I wrote http://stackoverflow.com/questions/1487406/vb6-automation-error-on-calls-to-net-3-5-assemblies-after-the-first-calls and built a C# DLL (see code below), and created one .tlb and one .reg file to expose its methods to COM. On PC2 I copied the .dll, .tlb and .reg into WINDOWS\system32, and executed the .reg to insert new entries to the registry. In Visual Basic 6, I created a new project, and added a https://bytes.com/topic/visual-basic-net/answers/598457-vb6-automation-error-trying-use-com-exposed-c-dll reference to the ..tlb. So far, everything seems to be ok. I can see the class in the object inspector, and browse its methods and enumerations. Also, the tool that shows as I type the valid methods and parameters works ok. Compilation to exe works fine. Problems start at run time. Just trying to instantiate one instance of the COM exposed class gives me a "Run-time error '-2147024894 (80070002) Automation error'". See VB6 code below, too. Both listings have dummy code. Any hint about what can this be due to? Thank you, Tremendo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%% using System; using System.Text; using System.Runtime.InteropServices; namespace N_Proc_CC1100_Test { public enum RadiobandTypes { RadiobandR =0, RadiobandRC, RadiobandRCS, RadiobandT } // ================================================== ======================= [GuidAttribute("AEB5062F-6695-4484-B07A-53C37A99E92B")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIDispatch)] public interface _C_Proc_CC1100_Test { [DispIdAttribute(1)] bool EnterTestMode(int RadiobandType); [DispIdAttribute(2)] bool LeaveTestMode(); [DispIdAttribute(3)] bool GetSoftwareVersion(out int version); [DispIdAttribute(4)] bool TestRF(out double PeakFrequency_MHz,out double PeakPower_dBm); [DispIdAttribute(5)] bool SetOutputs(int outputs); [DispIdAttribute(6)] bool GetInputs(out int inputs); } // ================================================== ======================= [GuidAttribute("A9BA5B44-A432-44ab-9AFA-6C8058B20AA8")] [ClassInterfaceAttribute(ClassInterfaceType.None)] [ProgIdAttribute("N_Test.C_Test")] public class C_Proc_CC1100_Test : _C
in VB6 Dev environ If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. http://www.vbforums.com/showthread.php?561154-COM-interop-automation-err-in-VB6-Dev-environ To start viewing messages, select the forum that you want to visit from the selection http://forums.asp.net/t/1562326.aspx?Registering+NET+Class+Library+DLL+with+VB6+App below. Results 1 to 7 of 7 Thread: COM interop; automation err in VB6 Dev environ Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Mar 10th, 2009,06:34 PM #1 KeyNoteSteve View Profile View Forum Posts Thread Starter New Member Join Date Jan 2008 Posts 6 COM automation error interop; automation err in VB6 Dev environ I have written a vb.net (VS2008) .dll sample. I have built these with the swithes for 'COM Interop'. I move this DLL from my VS2008 machine to my VB6 dev machine; run regasm xxx /tlb; and then write a little sample program to test the DLL. The significant parts of the program program are: ------------------------------------------ << reference is added to the dll>> Public M10 As Mar10Class.Mar10Class Private automation error vb6 Sub cmdMar10Class_Click() Set M10 = New Mar10Class.Mar10Class M10.HelloMsg ("Mar10 class Msg from VB6 ") End Sub --------------------------------------- If I compile the program, it behaves as expected, but if I try to run it in the dev environment, it gets Automation error The system cannot find the specified file The error happens on line "Set M10 = New Mar10Class....." I have thried this with 4 test dlls. The first one I wrote works in both the comile and dev mod. All others only work in compile mode. I moved one of the test projects to another machine that had the VB6 dev environment and on that machine none worked in the dev environ (and all worked when compiled). I can't see anything in the .net source code or project properties that would make a diference. Can anyone shed some light? Much appreciated. Reply With Quote Mar 10th, 2009,06:54 PM #2 dee-u View Profile View Forum Posts Visit Homepage Software Carpenter Join Date Feb 2005 Location Candon City, Ilocos Sur, Phils. Posts 10,924 Re: COM interop; automation err in VB6 Dev environ It should help to see your .net code for the dll. Regards, ™ As a gesture of gratitude please consider rating helpful posts. c",) Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox |
ASP.NET Community Standup Forums Help Home/ASP.NET Forums/Advanced ASP.NET/Architecture/Registering .NET Class Library DLL with VB6 App Registering .NET Class Library DLL with VB6 App [Answered]RSS 1 reply Last post Jun 06, 2010 11:11 PM by michael.lukatchik ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Reply michael.luka... Member 70 Points 47 Posts Registering .NET Class Library DLL with VB6 App May 26, 2010 12:21 PM|michael.lukatchik|LINK To be short and to the point, I've built a C# class library that is both COM-Visible and Registered for COM Interop. I've compiled the library, which resulted in the generation of .dll and .tlb files. I have another machine that's running a VB6 application. So, I copied the .dll and .tlb files over to C:/Windows/system32 folder on the machine. I then registered those files using the following: C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\Windows\system32\TestClass.dll /tlb:TestClass.tlb After the files were registered successfully, I added a project reference to the Test.tlb file from inside my VB6 app, then I tried to invoke a method in my new referenced class like so:Dim myObject As TestNamespace.TestClass Set myObject = New TestNamespace.TestClass MsgBox (myObject.TestMethod()) It doesn't work, and I receive a -2147024894 Automation Error. I've read that I shouldn't install the dll into a private folder like system32. I should either be registering in the GAC or I should be registering in another location using the "/codebase" option:C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\TestClass.dll /tlb:TestClass.tlb /codebase Is there any reason I shouldn't be using system32? Past devs that have worked on this project have placed assembly files used by this VB6 project into system32 and there haven't seemed to be any issues. When I register my dll in the system32 location, I get the Automation Error. When I register my dll in another location (i.e. C:/), the method call into my class library from VB6 works as expected. What gives? I should mention that we will NOT be using the GAC to register any DLL's. That's just the way it is. Any help is appreciated