The problem I'm running into is someone else's code which is crashing out with an eInvalidLayer error if it's run immediately after my code is run.
clarify immediately ?
I can't see anything that would cause an error.
Re your code.
Personally I'd make a generic routine and pass parameters to it ie : AssertMyLayers ( layerName, layerColor, layerLineType)
... This will save you reproducing this routine for each layer you want.
You don't need myTransMan .. you can do everything from the Transaction.
You make a string variable myWALLS to hold the layerName, yet you use a fixed string to set the SystemVariable.
If you want the layer ON and UNFROZEN and UNLOCKED just set them that way, no need to test current property.
You could use
db.Clayer = myLT[myWALLS]; <== sorry, I think in C#
in place of the Set SystemVariable call.
Regards
kdub