Defining fixed length variables in vs 2010 RRS feed

  • Question

  • Is there a way to define a fixed length variable in VS 2010. I am converting a process from Access to VS 2010 and need to be able to do this to be able to write fixed length fields to an output file. The old access code was:

    dim name as string * 25

    How do I accomplish this in vs 2010?


    • Moved by Cindy Meister MVPModerator Tuesday, November 13, 2012 8:36 AM .NET Framework question (From:Visual Studio Tools for Office)
    Monday, November 12, 2012 9:20 PM


  • I found the answer. In VS 2010 you can set the length of the file using the LSET command. For instance if you want a name field to be 25 characters long you just use the command as follows:

    NewName = LSET(Name, 25) - This will left justify the name field and give it a length of 25 (if the name is less than 25 characters it will pad the right with spaces).

    This is useful when creating e-files where fields have to be exact lengths.

    • Marked as answer by J-Bal Tuesday, November 27, 2012 2:36 PM
    Tuesday, November 27, 2012 2:36 PM

All replies