Results 1 to 3 of 3

Thread: Setting the focus in a textbox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    16

    Exclamation

    I have a textbox used for writing out a sql string to query a MS SQL Server 7.0 database.

    Above this textbox I have a serious of buttons with images of the logical operators to be used for compariosons.

    When the user clicks one of these buttons that operator is copied into the textbox.

    The focus stays on the button. I know i can change the focus to the textbox with the setfocus method however this places the caret at the beginning of the textbox.

    How do I get the caret to appear at the end of the textbox?

    Also when I place the operators into the textbox I'm doing something like this:

    Private Sub cmdLess_click()
    txtquery.Text = txtQuery.Text & "<"
    End Sub

    This code appends the operator to the end of the textbox string. What if a user moves the caret to the middle of the textbox - How do I insert the operator at the caret position?

    Thanks.

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    textbox.selstart = len(textbox.text)
    textbox.setfocus
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Didn't see the 2nd Part.

    'If I click in the middle of TextText I will end up with
    'TextJumpText

    TextBox.SelText = "Jump"
    TextBox.SetFocus
    '

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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