Shifting in String Format (With built in functions)
Hi all,
Consider a third party control to mimicking a progressbar with percentage. It has a FormatString in its properties which follows these type of custom numeric format strings provided by Microsoft.
How can I perform a decimal placement shifting to left (like diving per 10) not in a program way, on once done in properties in designing mode. i.e. for "271" (Bar maximum is 1000) the string "27.1%" is expected.
What I've tried:
Exponential (scientific notation) was only tested but I have no idea how to get rid of 'e' or 'E' in string.
Re: Shifting in String Format (With built in functions)
Since you have to assign the "current" value (271) in code, just set the Format to "%", but in code assign Value divided by BarMax (as long as BarMin is 1, otherwise you'd have to calculate)
--> you'd assign 271/1000 = 0.271
The "%" Format multiplies it with 100, which would result in "27.1%" shown in the Bar
Re: Shifting in String Format (With built in functions)
The value 271 will be generated by the control itself I'm afraid. But its FormatString is the key to solve it I suppose.
Re: Shifting in String Format (With built in functions)
Re: Shifting in String Format (With built in functions)
Nah mate. I am trying/failing the point is there are d, n, p, #, e ., 0 and lots of things to take care of. I should understand how it works first but I was hoping someone here have experienced such pain before to help.
Re: Shifting in String Format (With built in functions)
just a hail mary, try "0.#\%" in format string
Re: Shifting in String Format (With built in functions)
Quote:
Originally Posted by
pourkascheff
Hi all,
Consider a third party control to mimicking a progressbar with percentage. It has a FormatString in its properties which follows
these type of custom numeric format strings provided by Microsoft.
How can I perform a decimal placement shifting to left (like diving per 10) not in a program way, on once done in properties in designing mode. i.e. for "
271" (Bar maximum is 1000) the string "
27.1%" is expected.
What I've tried:
Exponential (scientific notation) was only tested but I have no idea how to get rid of 'e' or 'E' in string.
I would expect the control to handle that itself... if the max is 1000 and the value is 271... and the format is "%" i'd expect it to display "27.1%" or "27%" automatically ... especially if it's using the value ... other wise it would need an additional property to track the displayValue ...
-tg
Re: Shifting in String Format (With built in functions)
Quote:
Originally Posted by
techgnome
i'd expect it to display "27.1%" or "27%" automatically ...
Indeed, It does display "27%" But that 0.1% is important to me or let's say my employer and also user. How to have a sort of double percent format at the same time?
Re: Shifting in String Format (With built in functions)
Well if it support the standard/custom numeric format expressions, then this "{0:#0.##%}" should work ... ???
https://learn.microsoft.com/en-us/do...om-specifier-3
-tg