Results 1 to 5 of 5

Thread: how to incrment a string

  1. #1

    Thread Starter
    Member
    Join Date
    May 2007
    Posts
    60

    how to incrment a string

    hi there
    is it possibe with a string like str="a" to increment it
    for example if str=str+1 , i have str="b"
    thank you

  2. #2
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: how to incrment a string

    Hi there,
    Have a look at this thread:
    http://vbforums.com/showthread.php?t...ighlight=aa+ab

  3. #3
    Hyperactive Member Grunt's Avatar
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    499

    Re: how to incrment a string

    use the += operator

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

    Re: how to incrment a string

    You cannot increment a string because there's nothing numeric about a string. In some languages you can increment a character data type because they are stored as numbers, but that's not the case in .NET. The Char type is NOT a numeric type so it cannot be incremented. You can call Convert.ToInt32, then increment, then call Convert.ToChar.
    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

  5. #5
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: how to incrment a string

    i use something like str = Chr(Asc(str) += 1)
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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