CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    2

    Format$ is returning blank strings

    Hello!

    I'm using format to format a number in exactly 15 characters but this is returning a blank string, does anyone have an idea why?
    So far only text works eg. "ABC", not numbers.

    This is just a reduced demonstration i typed right now:
    _______________________________________________
    Private Sub ApplyCaption()
    Dim vSPC as string

    vSPC = string(15," ")

    lbldemo.caption = format$(str (VarInteger),vSPC)

    End Sub
    _________________________________________________


    Thanks a lot, I'm almost finished my freeware game and this is really getting in the way!

    Alex Pineda

    -------------------------------------------------
    Visit www.bluecatstudios.i-p.com

  2. #2
    Join Date
    Oct 2000
    Posts
    4

    Re: Format$ is returning blank strings

    Look up format in the help file i think you will find that when you set your format you need to use symbols instead of space characters
    format(blah,"*****")



  3. #3
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Format$ is returning blank strings

    Not sure how exactly you wanna format the number. But if you have 123 and you want the output to be 000000000000123, the code below should do it.

    Format(CStr(IntVal), "000000000000000")

    -Cool Bizs

    Good Luck,
    -Cool Bizs

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

Featured