Hi,
I'm trying to run a custom tool from an Editor Extension I am building. I've done this before with out of the box ArcMap tools (ie. Zoom to Selection), but for some reason this code I am using will not work for a custom tool I have created. The tool GUID is {079952c5-83c1-49e8-bd1a-4440f623281f} and it is definitely in my map, but when I run the tool it can't seem to find it based on the GUID, so cmdItem is null and the line "cmdItem.Execute();" does not run.
Any ideas what I am doing wrong??
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>inFeature<SPAN class="punctuation token">.</SPAN>Fields<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FindField</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"FACILITYID"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
ICommandBars cmdBars <SPAN class="operator token">=</SPAN> ArcMap<SPAN class="punctuation token">.</SPAN>Application<SPAN class="punctuation token">.</SPAN>Document<SPAN class="punctuation token">.</SPAN>CommandBars<SPAN class="punctuation token">;</SPAN>
UID uid <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">UID</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
uid<SPAN class="punctuation token">.</SPAN>Value <SPAN class="operator token">=</SPAN> <SPAN class="string token">"{079952c5-83c1-49e8-bd1a-4440f623281f}"</SPAN><SPAN class="punctuation token">;</SPAN>
ICommandItem cmdItem <SPAN class="operator token">=</SPAN> cmdBars<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Find</SPAN><SPAN class="punctuation token">(</SPAN>uid<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>cmdItem <SPAN class="operator token">!=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN>
cmdItem<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Execute</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>