Problem

How to get a Form File Resource


Solution

When designing a Form you could need to store some binary data (any file) as a resource. Resources like these could be used as images for buttons, for example, or to store some data for later use.

As an example, imagine you need to print an RTF document. You could embed the RTF file as a Form File Resource and with this code you could retrive it:

byte[] bt = thisForm.getResFile("<resource key>");
String rtf = new String(bt,0,bt.length,"UTF-8");

Published in Mon, 13 December 2010 11:48