Results 1 to 5 of 5

Thread: [RESOLVED] .focus masked text box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    17

    Resolved [RESOLVED] .focus masked text box

    I want to know how when you focus on a textbox in your form, how you get the cursor to go to the first character, instead of the middle/last/etc.

    Thank You.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: .focus masked text box

    use the .selectionstart property

  3. #3
    Hyperactive Member su ki's Avatar
    Join Date
    Oct 2007
    Posts
    354

    Re: .focus masked text box

    hey vb_2008

    use what .paul. has suggested

    vb Code:
    1. textbox1.selectionstart=0

    to set focus programatically
    use this

    textbox1.focus()
    * If my post helped you, please Rate it
    * If your problem is solved please also mark the thread resolved it is there in right top of page under thread tools
    * Why Rating is useful

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: .focus masked text box

    Hey,

    .Focus is a lower level method, and shouldn't be used, you should use .Select instead, have a look here:

    http://msdn.microsoft.com/en-us/libr...rol.focus.aspx

    In particular:

    Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.
    Gary

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    17

    Re: .focus masked text box

    Thanks for the replies. Very helpful.

    Thanks GEP, i will have to give that a good read. Was only taught the .Focus propety in UNI so i assumed that was the best to use. Good heads up.

Tags for this Thread

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