Is there a preferred way to format numeric data that is displayed in custom dialogs or on layouts?
That is a pretty broad question. It depends on what you are using the numeric data for. Currency? Serial Number? An array of some kind?
It is any numeric data that requires formatting - currency (dollar sign, thoursand separators, 2 decimals) , record numbers ( thousand separators, no decimals) - that kind of stuff.
I think quantitative data — including ordinal (record number), interval (temperature), and ratio (currency) data, but not numbers used to represent nominal data (IDs) — is almost always best formatted as right-aligned within a field to facilitate comparing numbers in columns.
Other than that, there are many different conventions for different types of numbers, and different conventions for the same types of numbers used for different purposes or in different regionalized solutions. For US currency, showing a leading "$" and using comma delimiters every 3 digits is pretty conventional, and a fixed number of decimals, usually 2, but sometimes 0 for big-picture figures. Fomatting negative numbers in red or surrounded by parentheses are common, but far from universal. Other countries have different conventions for every figure I just described. We just have to re-ask the same questions for every solution we build.
In general, use what is most readable. Unless your customer or user has a particular use case.
There are also a lot of 'security' reasons for using certain notations, as well as industry specific practices, like the currency symbol ( in USD '$' ). Including a "$" and 2 decimal places can help prevent check fraud...from the crooked type adding numbers at the beginning of a dollar figure, etc.
Retrieving data ...