Reading from and writing to the Clipboard

Have you ever tried putting something in the clipboard? Well, aside from literally copying or pasting?
If you have ever tried something like this in .NET, you might remember, you need to call the functionality in a thread with STA mode. Try doing this in your NAV Development Environment…

Below, you will find a download for a Clipboard Handler in NAV. It allows you to set or read the clipboard. For achieving this, we compile a .NET DLL in memory and execute that one.

Please note that this Codeunit is provided “as is”.

By using Reflection, we build some .NET code inside NAV. Next we call the correct functions.

If you want to use this Codeunit, you merely call the SetClipboardText or GetClipboardText.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.