Results 1 to 4 of 4

Thread: [RESOLVED] Show positive symbol for integer

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    15

    Resolved [RESOLVED] Show positive symbol for integer

    Hey all,

    One quick question.

    How do I have a positive number show the "+" sign before the number.

    I feel that this should be easy but my searches must be too broad because I get way more info than I want and don't seem to find the easy fix.


    Thanks in advance,
    Major

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Show positive symbol for integer

    If you want a "+" symbol before a number you prepend one yourself when you convert the number to a string. There's nothing that will do it for you automatically (that I've ever seen) because positive numbers are implied, in VB just as in the rest of the world.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Show positive symbol for integer

    There isn't an easy fix, because the only way to show that would be to add it. Assuming you have the number showing up as a string already, you need to do something like this:

    <wherever you are putting it> = "+" & <Number>.ToString

    It can't be done automatically.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    15

    Re: Show positive symbol for integer

    I was afraid of that.

    I kind of hoped there was a Format function that would accomplish this as some numbers will be negative and some positive.

    Thanks for your help, I'll set this as resolved.


    Major

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