Click here to Skip to main content
15,065,044 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

First I would like to apologize if my english is not perfect but it is not my mothertongue. Moreover I have not a real experience in programming neither in C++/C# nor in the .NET enviroment.

I need to create a new interface for entering data in a Acces database based on a tree control (to have a general idea I need to do something similar to what is described here A TreeView Control with ComboBox Dropdown Nodes) and I think the only viable solution is extending the Windows.Forms.TreeView control: it seems to me that the other tree controls present in the Microsoft library cannot be extended in such way.

Now I need to create an Activex Control to insert this control in the Access project, but I encountered several problems:
1) firstly I have tried to create an ActiveX from the C# library that include my extended TreeView control, but it seems that it is not possible to create an Office-compatible ActiveX starting from a C# library so I have abandoned this road.
2) I tried to create a MFC ActiveX merging two tutorial: this one A Complete ActiveX Web Control Tutorial that describes how to insert a DialogBox in an ActiveX and this one that describes how to intergrate a .NET User Control in a DialogBox. Both procedures work if performed alone, but if I try to integrate them and to test the ActiveX with TSTCon32.exe or inserting it in Access I get two different exceptions, both during the painting of the ActiveX:
-> if I try to use my control, called sharpControl, from another project in the same solution I get "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module with the additional information that it is impossible to load the assembly 'sharpControl, version...' or one of its dependencies. Impossible to find required file", but sharpControl.dll is correctly in the release folder with the ocx file. I get the same exception realising sharpControl in C++.
-> if I try to create a Windows Forms control in C++ in the same project of the MFC ActiveX, via Add - New Item, I get "An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module. Attempted to read or write protected memory"

Could someone suggest me something to try to solve this problem? Note that I only bounded to realise an Access-compatible ActiveX control with a tree-like interface provided with a textbox on every node, so I am not forced to extend the Windows.Forms.TreeView control.

Thanks a lot


ps: i use MS Access 2010 and Visual Studio 2010
Updated 29-Jul-13 0:13am
The_Inventor 31-Jul-13 2:58am
Try putting your DLL file in the C:\Windows\System32 folder, and C++ what happens.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900