Results 1 to 9 of 9

Thread: Shifting in String Format (With built in functions)

  1. #1

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    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.

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,261

    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

  3. #3

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    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.

  4. #4
    New Member
    Join Date
    Oct 2022
    Posts
    4

    Re: Shifting in String Format (With built in functions)

    Have you solved?
    Last edited by JeanneClark; Jun 30th, 2025 at 04:58 AM.

  5. #5

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    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.

  6. #6
    Addicted Member
    Join Date
    Jan 2022
    Posts
    211

    Re: Shifting in String Format (With built in functions)

    just a hail mary, try "0.#\%" in format string

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Shifting in String Format (With built in functions)

    Quote Originally Posted by pourkascheff View Post
    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Re: Shifting in String Format (With built in functions)

    Quote Originally Posted by techgnome View Post
    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?

  9. #9
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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
  •  



Click Here to Expand Forum to Full Width