Wrapper for VB6 error - "The system cannot find the file specified."
-
I have been struggling with this issue off and on for the last couple of weeks. I created a .NET project with a class that will be available to .NET and then another .NET project with a COM class that will make that first class available to VB6. I am not letting Visual Studio register the object for COM and am doing that myself. I am using the following commands to register the assembly.
gacutil /i TestCode.dll /f regasm TestCode.dll /tlb:TestCode.tlb /codebase
I am able to see the assembly in the references box in VB6 and I can use the intellisense but it wont let me use it. I have tried the following 2 ways to instantiate the object.Dim objTestCode As New TestCode.Testing
andDim objTestCode As TestCode.Testing Set objTestCode = New TestCode.Testing
Neither of those allow me to use the code. At one time I was able to use the assembly but that was last Friday and it was when Visual Studio was doing the registering for me. The reason I am manually registering it on my own box is that I want to replicate what will occur when this is deployed to multiple servers.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
-
I have been struggling with this issue off and on for the last couple of weeks. I created a .NET project with a class that will be available to .NET and then another .NET project with a COM class that will make that first class available to VB6. I am not letting Visual Studio register the object for COM and am doing that myself. I am using the following commands to register the assembly.
gacutil /i TestCode.dll /f regasm TestCode.dll /tlb:TestCode.tlb /codebase
I am able to see the assembly in the references box in VB6 and I can use the intellisense but it wont let me use it. I have tried the following 2 ways to instantiate the object.Dim objTestCode As New TestCode.Testing
andDim objTestCode As TestCode.Testing Set objTestCode = New TestCode.Testing
Neither of those allow me to use the code. At one time I was able to use the assembly but that was last Friday and it was when Visual Studio was doing the registering for me. The reason I am manually registering it on my own box is that I want to replicate what will occur when this is deployed to multiple servers.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
Howdy, Cleako, I think I may be up against a similar problem. It sounds as if we're both aiming for the same goal. What failure do you get when you say that "it won't let me use it" ?? I posted the following question yesterday as well on a different forum within this site. --Chris --------------------------------------------------------------------- Howdy, I am an RF engineer (read: non-programmer!) building a library of GPIB-instruments that I can use from various applications (.NET C#, Excel VB6) to script a few tests. This article has been *extremely* useful, although now I'm stuck at one error in Excel VB6 I can't resolve: "File or assembly name instrument_drivers, or one of its dependencies, was not found" What does seem to be working correctly: - My dll, "instrument_drivers", shows up in the list of VB6 references - I can 'Dim x As instrument_drivers.HP8648C' in my code (and the intellisense does recognize all of the class subroutines that I've made public, - I can 'Set x = New instrument_drivers.HP8648C', again with confirmation of intellisense, - I can 'x.open_device(23)', one of the subroutines But, I get the above error when I go to run it. Google searches churn up similar problems from other programmers, notably opening permissions in a windows temp directory and disabling file indexing. All done, no luck. Any ideas or comments are greatly appreciated, --Chris
-
Howdy, Cleako, I think I may be up against a similar problem. It sounds as if we're both aiming for the same goal. What failure do you get when you say that "it won't let me use it" ?? I posted the following question yesterday as well on a different forum within this site. --Chris --------------------------------------------------------------------- Howdy, I am an RF engineer (read: non-programmer!) building a library of GPIB-instruments that I can use from various applications (.NET C#, Excel VB6) to script a few tests. This article has been *extremely* useful, although now I'm stuck at one error in Excel VB6 I can't resolve: "File or assembly name instrument_drivers, or one of its dependencies, was not found" What does seem to be working correctly: - My dll, "instrument_drivers", shows up in the list of VB6 references - I can 'Dim x As instrument_drivers.HP8648C' in my code (and the intellisense does recognize all of the class subroutines that I've made public, - I can 'Set x = New instrument_drivers.HP8648C', again with confirmation of intellisense, - I can 'x.open_device(23)', one of the subroutines But, I get the above error when I go to run it. Google searches churn up similar problems from other programmers, notably opening permissions in a windows temp directory and disabling file indexing. All done, no luck. Any ideas or comments are greatly appreciated, --Chris
I ended up not using the gacutil /i part and just used the regasm part but it became a 2 line command.
regasm TestCode.dll /codebase regasm TestCode.dll /tlb:TestCode.tlb
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
-
I have been struggling with this issue off and on for the last couple of weeks. I created a .NET project with a class that will be available to .NET and then another .NET project with a COM class that will make that first class available to VB6. I am not letting Visual Studio register the object for COM and am doing that myself. I am using the following commands to register the assembly.
gacutil /i TestCode.dll /f regasm TestCode.dll /tlb:TestCode.tlb /codebase
I am able to see the assembly in the references box in VB6 and I can use the intellisense but it wont let me use it. I have tried the following 2 ways to instantiate the object.Dim objTestCode As New TestCode.Testing
andDim objTestCode As TestCode.Testing Set objTestCode = New TestCode.Testing
Neither of those allow me to use the code. At one time I was able to use the assembly but that was last Friday and it was when Visual Studio was doing the registering for me. The reason I am manually registering it on my own box is that I want to replicate what will occur when this is deployed to multiple servers.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
Curious. How are you adding the COM Guids to your assembly?? When I need to create a COM component in VB.NET, this[^] is the template I follow.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Curious. How are you adding the COM Guids to your assembly?? When I need to create a COM component in VB.NET, this[^] is the template I follow.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007I used this[^]. The class worked great and I am still confused why they say I must use
Regasm AssemblyName.dll /tlb: FileName.tlb /codebase
and notRegasm AssemblyName.dll /codebase Regasm AssemblyName.dll /tlb: FileName.tlb /codebase
. I may be totally wrong but the only thing that worked for me was that 2nd way which I found here, partially[^] but I ended up having to use the combination of the 2. I was successful installing to the GAC but the combination of installing to the GAC and registering the assembly seemed to confuse the code.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
-
I ended up not using the gacutil /i part and just used the regasm part but it became a 2 line command.
regasm TestCode.dll /codebase regasm TestCode.dll /tlb:TestCode.tlb
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
I was having the same problem. the /codebase switch made it work. Thanks!