C
Cindy M -WordMVP-
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 (and why).
txtNote.Text = "the text"
txtNote.Enabled = True
'txtNote.Select()
txtNote.Select(0, 0) 'deselect text
txtNote is a textbox control on a windows form. 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 - once to
put the focus into the control, once to change what's
selected - or am I missing something?
TIA, Cindy
-- Cindy
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 (and why).
txtNote.Text = "the text"
txtNote.Enabled = True
'txtNote.Select()
txtNote.Select(0, 0) 'deselect text
txtNote is a textbox control on a windows form. 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 - once to
put the focus into the control, once to change what's
selected - or am I missing something?
TIA, Cindy
-- Cindy