2

I'm trying to save a custom layer by doing the following

ILayerFile layerFile = new LayerFileClass();
layerFile.New(saveFileDialog.FileName);
layerFile.ReplaceContents((ILayer)customProperty);
layerFile.save();

The custom property is actually CustomLayer2 which is nothing but a class that extends the BaseCustomLayer

It gets to layerFile.save() but then craps out. I get the following error

Error: HRESULT E_FAIL has been returned from a call to a COM component

I'm not sure if this is because I'm trying to save a custom layer or not. But since BaseCustomLayer extends the ILayer shouldn't this be all good? It's not failing at ReplaceContents and it looks like data is actually getting there. The only field that's null is ThumbNail. Can this be null? Does it need to be created in the CustomLayer class?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Oct 13, 2010 at 21:26

1 Answer 1

6

Try overriding all the IPersistVariant methods, if that doesn't work maybe implement IPersistStream.

answered Oct 13, 2010 at 21:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.