csharp79

Use layer without add it in TOC

Discussion created by csharp79 on Aug 29, 2011
Latest reply on Aug 31, 2011 by madgame
Hi forum,

I have a question, how can I use layer without add it in the TOC?

Currently I add in the toc the layers that I need and than I use it with the following code:

IFeatureLayer sourceFeatureLayer = GetLayerByName("Layer_Name");
....
....

public IFeatureLayer GetLayerByName(string LyName)
        {
            IMap pMap = m_hookHelper.FocusMap;
            for (int i = 0; i < pMap.LayerCount; i++)
            {
                if (pMap.get_Layer(i).Name == LyName)
                    return (pMap.get_Layer(i) as IFeatureLayer);
            }
            return null;
        }


Now, I would like to use the same layers but without adding them in toc.
I would like to specify only the folder that contains all the layers and use them from there, is it possible?
how?

I hope you will help me!!!
Bye!

Outcomes