|
-
Jul 6th, 2023, 04:22 AM
#1
Thread Starter
Hyperactive Member
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.
-
Jul 6th, 2023, 05:02 AM
#2
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
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jul 6th, 2023, 05:32 AM
#3
Thread Starter
Hyperactive Member
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.
-
Jul 7th, 2023, 03:15 AM
#4
New Member
Re: Shifting in String Format (With built in functions)
Last edited by JeanneClark; Jun 30th, 2025 at 04:58 AM.
-
Jul 7th, 2023, 07:59 AM
#5
Thread Starter
Hyperactive Member
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.
-
Jul 7th, 2023, 08:34 AM
#6
Addicted Member
Re: Shifting in String Format (With built in functions)
just a hail mary, try "0.#\%" in format string
-
Jul 7th, 2023, 09:09 AM
#7
Re: Shifting in String Format (With built in functions)
 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
-
Jul 8th, 2023, 07:37 AM
#8
Thread Starter
Hyperactive Member
Re: Shifting in String Format (With built in functions)
 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?
-
Jul 8th, 2023, 11:04 AM
#9
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|