sai002

Refering the layers by name in TOC

Discussion created by sai002 on Nov 30, 2010
Latest reply on Dec 1, 2010 by jamesfreddyc
I developed an application where after installing it in the Arc Map, for its analysis it takes the layers containing the name xxxxxwatershed & xxxxxwatchtowers in the current mxd where the application is running.

Here,the first five x???s may be numbers or alphabets or underscores or anything, could anyone please suggest me how can I program it in my application such that when the application is run in Arc Map, it must recognize the feature layers that are ending with ???watershed??? and ???watchtowers??? and first five xxxxx may be any characters or alphabets or numbers.

Right now I am referring through these feature layers by index numbers,assuming user will keep the first layer in TOC the "xxxxxwatchtower" and the second as "xxxxxwatershed" :

IFeatureLayer watchtower = pMap.get_Layer(0) as IFeatureLayer;
IFeatureLayer watershed = pMap.get_Layer(1) as IFeatureLayer;

Outcomes