Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > SELECT method for a textbox control: broken or by design?

Thread Tools

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

Cindy M -WordMVP-
Posts: n/a
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(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

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

-- Cindy

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are "broken iterators" broken? Steven D'Aprano Python 8 09-28-2008 09:19 PM
Re: Why are "broken iterators" broken? Fredrik Lundh Python 0 09-22-2008 04:32 PM
Re: Why are "broken iterators" broken? Cameron Simpson Python 0 09-22-2008 04:32 AM
Kernel#select docs broken? msoulier Ruby 1 12-19-2006 02:32 AM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM