CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: textBox

  1. #1
    Guest

    textBox

    Hi

    I want to know, when i do a gotfocus on a txtbox, how to select automaticly to text in it. I have a passwordd txtBox, if the user enter a bad one, a error message occur and i do a setfocus on this txtBix and i would like that tyhe password entered should be selected. Like that i could write a new one without erased manually the old one. I hope you understands what i mean, i'm not realy goode in english

    Thanks a lot


  2. #2
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: textBox

    I use this procedure in a module (so it is acessed in all of my forms)

    public Sub Hilightext(ctl as Control)
    ctl.SelStart = 0
    ctl.SelLength = len(ctl)
    End Sub




    so for instance if you text box is callt text1 then in your got focus you would put
    hilighttext text1

    this will select all the text that is in text1 and erase it if a character is type in.



    David Paulson

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