Re: Price Data Formatting



"Webbiz" <noreply@xxxxxxx> wrote in message news:ewH%23BUiAJHA.3952@xxxxxxxxxxxxxxxxxxxxxxx

Hi Mike. Thanks for your comments. Yes, I understand how
the Format() function works. The exercise here, however, is
that the data format is NOT KNOWN during design time but is based on the format of the data loaded during runtime.

The thing is you have not yet given us sufficient information about what you are doing. For example, in what format is the data as you are loading it in. Is it being loaded as a floating point value (Single or Double or whatever) is is it being loaded as a formatted string? Perhaps if you post a snippet oif code showing where you are loading this data from and exactly how you are loading it we might be in a better position to help.

Another example of where more information is needed is regarding your statement when you said, "For example, if the program loads in data that appears to be 'MOSTLY' one digit to the left of the decimal and 3 to the right, I want all numbers that result from any calculations on this data to also be in the same format [with three decimal places]". Do you really mean that? It sounds a bit odd to me. For example, suppose you test a set of incoming data and you discover that 10 values have two decimal places and 48 values have three decimal places and 32 values have four decimal places. In this cases the data MOSTLY has three decimal places. Do you REALLY want to truncate ALL displayed values so that they all have three decimal places, missing off the fourth decimal digit from the 32 values that originally had four digits? It does not sound at all like the right thing to do if you want my opinion. In the specific example I have just described I would personally show all values to four decimal places. In other words, perhaps you should be looking for the MAXIMUM number of decimal digits in the data items, ignoring "odd balls" that have a lot more than the average (such as the odd 1.2344999999989 that might creep in somewhere).

The other thing we have asked that you haven't yet provided an answer to is *where are you displaying the resultant output*. This is VERY important, as we cannot give much useful advice unless we know how you are displaying it. For example, are you printing the ouput using Print statements (perhaps to a Form or a PictureBox or a Printer) or are you placing it in some sort of control, such as a TextBox or a ListBox? Perhaps you woud like to answer that question?

My advice, regardless of where you are displaying the data, is to display it in such a way that the decimal point is set in a fixed position and the "whole part" of the number is displayed right aligned to the left of the decimal point with the decimal part displayed left aligned to the right of it, and with sufficient trailing zeros to accommodate however many decimal digits you have decided to display. But the best method of doing this will vary greatly, depending on your output device and the font you wish to use, which you haven't yet told us about.

Mike




.



Relevant Pages

  • Re: Cant format (erase) hard drive
    ... > well with the new C drive, I tried to format the old drive E. I ... > window is displaying the contents of the drive. ... > program or disk utility could be open since I would not have changed the ...
    (microsoft.public.windowsxp.hardware)
  • Re: ddMMMMyyyy
    ... Create a query, and explicitly format the dates there. ... > but in the Word document after merging the ... > date can appear with what should be the day displaying as ...
    (microsoft.public.access.tablesdbdesign)
  • Re: DTpicker format
    ... >> seems to indicate that you think pressing the left arrow when the ... >> field is highlighted somehow exits the control. ... First off, to find out which format the control is displaying in, simply ...
    (microsoft.public.vb.controls)
  • Re: Force Built-In Style Name Change?
    ... any way to suppress Word's displaying the NUMBER FORMAT as ... you can label buttons or list entries). ... This reply is posted in the Newsgroup; ...
    (microsoft.public.word.customization.menustoolbars)
  • Re: Phantom decimal places
    ... These inaccuracies are inherent in floating point numbers. ... > simple calculations on them and then displaying the result in text boxes, ... > because it could vary) and no format, ... > How do I get numbers to display the correct data without the ghost decimal ...
    (microsoft.public.access.forms)