How to use COM UI components in Visual Studio 2010 for ArcMap 10 extension?

1470
1
07-12-2012 08:49 AM
SuiHuang
Occasional Contributor II
Hi Everybody:

    I am trying to use some UI components provided by ArcObjects 10 in my ArcMap 10 Extension developed under Visual Studio 2010, but was not successful. Following are the steps I did. Can you help me to see how should I make it work? Thank you!

1. Create an ArcMap extension with a draggable window.

2. In Visual Studio 2010, make a COM component UI tool available. In this test I chose MdListCtrl Class
[ATTACH=CONFIG]16017[/ATTACH]

3. Then drag and drop a MdListCtrl on to draggable window.
[ATTACH=CONFIG]16018[/ATTACH]

4. After compiling, I get two error messages.
[ATTACH=CONFIG]16019[/ATTACH]

5. An esriSearch reference is found. It is actually refering to ESRI.ArcGIS.System, which is already referred. I then deleted the esriSearch reference.
[ATTACH=CONFIG]16020[/ATTACH]

6. After compiling an error on resource file is found.
[ATTACH=CONFIG]16021[/ATTACH]


Is there anyway I can make it work?

Thank you!
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: huangs3

Hi Everybody:

    I found the reason of there error: the reference used by the ArcGIS Desktop COM UI controls conflict with the existing references.
    Here are the steps I did to figure this:

1. Create an ArcMap Class Library project.

2. Create a Visual Studios standard Windows form under the project.

3. Drag and drop a MdListCtrl control onto the form.

4. At this point the project can be successfully compiled, which means the COM UI component itself can be used Visual Studios project. I also noticed that a group of references are added to the project.

5. Add a ESRI ArcMap Desktop Base Command into the projects.

6. At this point the project cannot be successfully compiled, which means the newly added Base Command and the COM UI component are conflicting each other. Looking at the error message (refer to the first post in this thread), and the newly added references for the Base Command, the root cause should be that the references are conflicting each other.
[ATTACH=CONFIG]16029[/ATTACH]

Is there anyway to resolve the conflict? Thank you!
0 Kudos