Results 1 to 3 of 3

Thread: String Behavior

  1. #1

    Thread Starter
    Addicted Member billyblue's Avatar
    Join Date
    Dec 2008
    Location
    Belfast
    Posts
    203

    Thumbs up String Behavior

    Hi Guys,

    I was wondering is there a way I could do the following. I want to display a string as follows.



    I want the info to be surrounded by a neat box a little like something you would see in notepad. The issue is that the values x,y and z will all change in length as they will be dynamic. Is there a way to ensure that the right "|" sides dont move? Just so I can have a nice neat right hand side.

    I have vague memories of doing something similar in java to do with tab? Could have imagined it.

    All help is appreciated.

    Cheers People

    BB
    Last edited by billyblue; Jan 6th, 2009 at 07:59 PM.

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

    Re: String Behavior

    Convert x, y and z to Strings if they aren't already and then call PadRight to add as many spaces as are needed to create a String of a specific length. If you call PadRight(20) then the result will always be 20 characters long. If the initial string was 10 characters long then 10 spaces would be added. If the original length was 15 then 5 spaces would be added, etc.
    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

    Thread Starter
    Addicted Member billyblue's Avatar
    Join Date
    Dec 2008
    Location
    Belfast
    Posts
    203

    Red face Re: String Behavior

    Quote Originally Posted by jmcilhinney
    Convert x, y and z to Strings if they aren't already and then call PadRight to add as many spaces as are needed to create a String of a specific length. If you call PadRight(20) then the result will always be 20 characters long. If the initial string was 10 characters long then 10 spaces would be added. If the original length was 15 then 5 spaces would be added, etc.
    Fantastic. Thanks jmc. I will give that a go after I get some sleep

    Cheers

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