C# - how to loop a command and program user exit via escape button

I'm trying to multiple insert a block/drawing with the possibility to exit the function with the escape button. But I can't get the exit programmed. It works fine without the loop. I have tried several ways, one like mentioned in this Acad post, but can't get it done. Anyone a good idea where to start or how to do it?

This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!