Results 1 to 4 of 4

Thread: Question about Focus and selectionstart

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    2

    Question about Focus and selectionstart

    hey everyone,

    Private Sub rtbreceive_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtbOntvangen.TextChanged
    rtbreceive.SelectionStart = rtbreceive.TextLength
    rtbreceive.ScrollToCaret()
    rtbreceive.Focus()
    End Sub

    rtbreceive = a richtextbox

    Would someone give some explanation what a .Focus and .Selectionstart do?
    Last edited by Arash; Jan 7th, 2009 at 05:34 PM.

  2. #2
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Question about Focus and selectionstart

    You could just look them up in the documentation?

    Anyway... Off the top of my head, SelectionStart gets or sets the cursor position (in character numbers), and Focus is a VB6 left-over that sets the focus to the control. I believe you should now use either control.Select, or Me.ActiveControl = control.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    2

    Re: Question about Focus and selectionstart

    Thx i get it know

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Question about Focus and selectionstart

    .Focus is not something to use normally, as you probably read. Use .Select instead.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

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