473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using a .NET component in VFP

Hi All,

I've been working on building a .dll in C# (framework 1.1) and using it in
VFP8. As always, the example that runs so smoothly in the article fails at
a rather basic point in practice. When attempting to create the object,

After building a dll, I used RegAsm.exe to register and received "Types
registered successfully" message. But upon trying to create the object in
VFP, I get the error:

OLE error code 0x80070002: The system cannot find the file specified.

Anyone have an idea what (probably basic) thing I'm missing here?

TIA,

John
Nov 15 '05 #1
3 4642
In article <ed*************@TK2MSFTNGP11.phx.gbl>, js******@c-comld.com
says...
Hi All,

I've been working on building a .dll in C# (framework 1.1) and using it in
VFP8. As always, the example that runs so smoothly in the article fails at
a rather basic point in practice. When attempting to create the object,

After building a dll, I used RegAsm.exe to register and received "Types
registered successfully" message. But upon trying to create the object in
VFP, I get the error:

OLE error code 0x80070002: The system cannot find the file specified.

Anyone have an idea what (probably basic) thing I'm missing here?


Usually, .NET assemblies reside in the same directory as the executable
(even with COM-interop). I've had this happen before when doing stuff
inside the VB6 IDE. I had to place the .NET assembly in the same
directory as the IDE (VB6.EXE). Perhaps VFP needs this to.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #2
Thanks, Patrick. I'll start playing around with that idea. Here's an
oddity I have yet to figure out...

I got it to work (instantiates in VFP and works as expected). By doing the
following steps:

1. Generated a strong name using sn.exe;
2. Added attributes to the cs file for reflection to identify a version and
use the strong name;
3. Built the DLL using the /define:STRONG switch; and
4. Ran GACUtil to load into the GAC.

I've tried the same process with another .cs file in the same folder, yet it
continues to give the same error. If it helps, here are the starts of both
files:

//This worked:
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.Runtime.InteropServices;

#if STRONG
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyKeyFile("DotNet.snk")]
#endif

namespace DotNetCOM
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId("DotNetCOM.wwImaging")]
public class wwImaging : Component
{...}
}
//This builds and adds to the cache but still gives same error (cannot find
the file):
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;

#if STRONG
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyKeyFile("Calculator.snk" )]
#endif

namespace Mathematics
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId("Mathematics.Calculator")]
public class Calculator : Component
{...}
}

Thanks again,

John

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <ed*************@TK2MSFTNGP11.phx.gbl>, js******@c-comld.com
says...
Hi All,

I've been working on building a .dll in C# (framework 1.1) and using it in VFP8. As always, the example that runs so smoothly in the article fails at a rather basic point in practice. When attempting to create the object,

After building a dll, I used RegAsm.exe to register and received "Types
registered successfully" message. But upon trying to create the object in VFP, I get the error:

OLE error code 0x80070002: The system cannot find the file specified.

Anyone have an idea what (probably basic) thing I'm missing here?


Usually, .NET assemblies reside in the same directory as the executable
(even with COM-interop). I've had this happen before when doing stuff
inside the VB6 IDE. I had to place the .NET assembly in the same
directory as the IDE (VB6.EXE). Perhaps VFP needs this to.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 15 '05 #3
One more piece and I think I've got it!

In previous attempts, it appears that a type library had been built and
registered for the one that was working. For the other, I can't recall if I
had built one. However, once I did, it too worked. It seems if I add step
3.5: Build and register tlb file with RegAsm; it comes together!
"John Spiegel" <js******@c-comld.com> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
Thanks, Patrick. I'll start playing around with that idea. Here's an
oddity I have yet to figure out...

I got it to work (instantiates in VFP and works as expected). By doing the following steps:

1. Generated a strong name using sn.exe;
2. Added attributes to the cs file for reflection to identify a version and use the strong name;
3. Built the DLL using the /define:STRONG switch; and
4. Ran GACUtil to load into the GAC.

I've tried the same process with another .cs file in the same folder, yet it continues to give the same error. If it helps, here are the starts of both files:

//This worked:
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.Runtime.InteropServices;

#if STRONG
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyKeyFile("DotNet.snk")]
#endif

namespace DotNetCOM
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId("DotNetCOM.wwImaging")]
public class wwImaging : Component
{...}
}
//This builds and adds to the cache but still gives same error (cannot find the file):
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;

#if STRONG
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyKeyFile("Calculator.snk" )]
#endif

namespace Mathematics
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId("Mathematics.Calculator")]
public class Calculator : Component
{...}
}

Thanks again,

John

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <ed*************@TK2MSFTNGP11.phx.gbl>, js******@c-comld.com
says...
Hi All,

I've been working on building a .dll in C# (framework 1.1) and using it
in
VFP8. As always, the example that runs so smoothly in the article
fails
at a rather basic point in practice. When attempting to create the
object,
After building a dll, I used RegAsm.exe to register and received "Types registered successfully" message. But upon trying to create the
object in VFP, I get the error:

OLE error code 0x80070002: The system cannot find the file specified.

Anyone have an idea what (probably basic) thing I'm missing here?


Usually, .NET assemblies reside in the same directory as the executable
(even with COM-interop). I've had this happen before when doing stuff
inside the VB6 IDE. I had to place the .NET assembly in the same
directory as the IDE (VB6.EXE). Perhaps VFP needs this to.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and...
6
by: Mario T. Lanza | last post by:
Greetings, I don't know about you guys but on many occasions I've asked myself whether or not someone else has solved a particular programming issue -- whether or not they developed a clever...
1
by: Raffe | last post by:
Hi all! I've been playing a bit with Component Designer in Visual Studio.NET. Seems to me like a great way to build simple data access components using "point and click". However I can't figure...
6
by: Sivaraman.S | last post by:
Hi, I have a doubt in .net. Hope u could solve the problem. When u r free plz consider this doubt. I have created a component to run End of Day Tasks. Hope u know how much time it takes to...
2
by: Phuff | last post by:
I have an application that should run in the system tray while open. It is supposed to be open at all times and I need it to dissapear when the "X" button is pushed on the form...but without...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
3
by: gary.bernstein | last post by:
I want to call a singleton getInstance function to retrieve a templatized object without knowing what types were used to create the singleton object in the first call to getInstance. How can I do...
2
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I have installed my windows application that uses XpdfViewer (a COM Component for view Pdfs) using ClickOnce. But I get this error:
4
by: saritha2008 | last post by:
Hi, Iam working on converting one of xml file to other form of xml using XSLT. As part of this, I need to count the no. of "component" nodes in the xml file given below. If there is only one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.