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. Advertising

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. S. Justin Gengo
    Replies:
    0
    Views:
    537
    S. Justin Gengo
    Jul 16, 2003
  2. Steven D'Aprano

    Why are "broken iterators" broken?

    Steven D'Aprano, Sep 21, 2008, in forum: Python
    Replies:
    8
    Views:
    661
  3. Cameron Simpson

    Re: Why are "broken iterators" broken?

    Cameron Simpson, Sep 22, 2008, in forum: Python
    Replies:
    0
    Views:
    590
    Cameron Simpson
    Sep 22, 2008
  4. Fredrik Lundh

    Re: Why are "broken iterators" broken?

    Fredrik Lundh, Sep 22, 2008, in forum: Python
    Replies:
    0
    Views:
    608
    Fredrik Lundh
    Sep 22, 2008
  5. palmiere
    Replies:
    1
    Views:
    413
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page