CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    233

    Exclamation Text Box Control

    Hi. Lets say i have a textbox with the string "This is a text box" entered into it. What code can i use to read the first letter or character in the text box (in this example, "T") and then delete the first letter, leaving "his is a text box"?
    Seed Gaming
    www.seedgaming.com

  2. #2
    Join Date
    Oct 2006
    Posts
    65

    Re: Text Box Control

    Code:
    left(text1.text,1) 'Show "T"
    right(text1.text,len(text1.text)-1) ' Show text without first "T"

  3. #3
    Join Date
    Aug 2006
    Posts
    145

    Re: Text Box Control

    for deleting the first character, you could also use Mid$:
    Code:
    Text1.Text = Mid$(Text1.Text1, 2)

  4. #4
    Join Date
    Mar 2005
    Location
    Nottingham, UK
    Posts
    665

    Re: Text Box Control

    Even shorter, use Mid$ to remove the first character
    Code:
    Text1 = Mid$(Text1, 2)
    I also prefer to be strict and use Left$, Mid$, Right$ etc which enforce variable type. Without the dollar sign they return variants.

    Edit - Snap, Bushmobile!
    (\/)
    (-.-)
    (')(')


    Bunny's quest for world domination continues.

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