SELECT method for a textbox control: broken or by design?

Discussion in 'ASP .Net' started by Cindy M -WordMVP-, Dec 2, 2003.

  1. Hi all

    While working my way through a VB.NET exercise, I came
    across something that didn't do what the text said it
    should and I'm wondering if it's supposed to behave this
    way, or not.

    txtNote.Text = AllText
    txtNote.Enabled = True
    'txtNote.Select()
    txtNote.Select(0, 0) 'deselect text

    txtNote is a textbox control on a windows form. Alltext is
    a string variable. As the code stands, the txtNote control
    is NOT selected, focus remains in the control that had the
    selection when the code is executed.

    If I include the line that's currently commented out, first
    selecting the control specifically, then setting the
    selection length (doesn't matter what numbers I put in the
    function), it works as I'd expect, and focus is in the text
    box.

    Should it always be necessary to use Select twice, or am I
    missing something?

    -- Cindy
     
    Cindy M -WordMVP-, Dec 2, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    873
  2. Steven D'Aprano

    Why are "broken iterators" broken?

    Steven D'Aprano, Sep 21, 2008, in forum: Python
    Replies:
    8
    Views:
    944
  3. Replies:
    1
    Views:
    595
    Teemu Keiski
    Jul 2, 2003
  4. mc
    Replies:
    4
    Views:
    206
    Steven Cheng[MSFT]
    Mar 19, 2007
  5. dom

    Bug in the design view TextBox control

    dom, Mar 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    164
  6. ErwinP
    Replies:
    1
    Views:
    1,131
    ErwinP
    Aug 19, 2005
  7. msoulier

    Kernel#select docs broken?

    msoulier, Dec 19, 2006, in forum: Ruby
    Replies:
    1
    Views:
    139
    George Ogata
    Dec 19, 2006
  8. palmiere
    Replies:
    1
    Views:
    681
    Erwin Moller
    Feb 9, 2004
Loading...