Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB6.FixedLengthString(#) - Alternate

VB6.FixedLengthString(#) - Alternate

Scheduled Pinned Locked Moved Visual Basic
helptestingbeta-testingtutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nlindley7
    wrote on last edited by
    #1

    I was wondering if anyone had a good solution to replacing VB6.FixedLengthStrings(). I need to be able to have a constant length for strings in a function. I tried Dim str As String = Space(#), and that works fine until you set the string to its value (spaces disappear), so its apparent that is not the correct way to fix this problem. Ive been thinking about testing to see the difference between the max length of the value and the max length of the string, but I'm not sure how to put a certain number of spaces to the end of the string as you cannot insert spaces with string.insert(pos, chars). Any thoughts? Nathan Lindley

    N 1 Reply Last reply
    0
    • N nlindley7

      I was wondering if anyone had a good solution to replacing VB6.FixedLengthStrings(). I need to be able to have a constant length for strings in a function. I tried Dim str As String = Space(#), and that works fine until you set the string to its value (spaces disappear), so its apparent that is not the correct way to fix this problem. Ive been thinking about testing to see the difference between the max length of the value and the max length of the string, but I'm not sure how to put a certain number of spaces to the end of the string as you cannot insert spaces with string.insert(pos, chars). Any thoughts? Nathan Lindley

      N Offline
      N Offline
      nlarson11
      wrote on last edited by
      #2

      Dim sVal as string Or CONST MIN_SIZE as int16 = 15 Dim s As String = "" s = "Hello" s = s.PadRight(MIN_SIZE, " ")

      N 1 Reply Last reply
      0
      • N nlarson11

        Dim sVal as string Or CONST MIN_SIZE as int16 = 15 Dim s As String = "" s = "Hello" s = s.PadRight(MIN_SIZE, " ")

        N Offline
        N Offline
        nlindley7
        wrote on last edited by
        #3

        Tried the first one but it was to no avail, but the second one is money. Thanks. Nathan Lindley

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups