Results 1 to 4 of 4

Thread: Selecting Text

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    25
    Here's my problem.

    I've got a couple of textboxes where you can go through by the TAB stops.

    Now I want to selct the text in the textbox, so it get's blue, and onde you type the original text dissappears and the new text appears.

    At the moment you have to delete the original text first ( by a couple of backspaces, pretty annoying)

    Anyone of you got a solution ?

    Kleinvaag

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    Try this for each text box you have:

    Code:
    Private Sub Text1_GotFocus()
        Text1.SelStart = 0
        Text1.SelLength = Len(Text1.Text)
    End Sub
    Hope this helps

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    In the gotfocus event set

    txtbox.selstart=0
    txtbox.sellength=len(txtbox.text)


    where txtbox is your textbox

    now when you tab onit it will be blue and typing will overwrite the contents.

    Regards

    Chris
    VB6 VS2005

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    25

    Hi Chrisa_uk adn S@NSIS,

    It works :-)

    Thx a lot.

    Kleinvaag

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