Results 1 to 5 of 5

Thread: Selecting Text

  1. #1
    Join Date
    Mar 2003
    Location
    N. Ireland
    Posts
    12

    Selecting Text

    Does anyone know how to work with text that has been cut or copied?

    I have been trying to develop a form containing a large text box. I want the user to select a portion of the text (click and drag over the text) and then right click to a menu to get the database to copy that text to another text box on a different form.


    I can use the SendKeys action to perform a Ctrl C but don't know how to paste this into another text box.

    Any ideas gratefully received.

  2. #2
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    Can you use the sendkeys to send Ctrl V when the text you want to paste into has the focus. i.e. its GotFocus event

  3. #3
    Join Date
    Feb 2003
    Posts
    102

    What about a Popup Menu?

    Hey Donall,

    Why not just create you own custom popup menu for the controls in question? Put the relevant cut, copy, paste commands on popup and the users can just right click and do what needs to be done.

    You can also set it up so popup menu items/elements fire your own hand rolled functions.

    It's simple to do, once you figure out the cluncky (IMO) interface that MS have set up to create/modify toolbars.

    HTH,

    Peter

  4. #4
    Join Date
    Mar 2003
    Location
    N. Ireland
    Posts
    12
    Yes I can use SendKeys to implement a Ctrl V. Unfortunately even if the textbox I want to paste to has the focus if doesn't seem to want to paste into it. Am I doing somthing wrong? It seems to be that Ctrl V only works when you are in a text box and editing the text.
    In an ideal world I would like to select whatever text is in the text box and paste over that, but my main problem is that I can't work out how to automatically select text within a text box in the same way as clicking and draging over it.

    I think my solution will come from either being able to Ctrl V into a text box or loading a text box from wherever the copied text is stored.

    Thanks for your time

  5. #5
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    Originally posted by Donall

    In an ideal world I would like to select whatever text is in the text box and paste over that, but my main problem is that I can't work out how to automatically select text within a text box in the same way as clicking and draging over it.
    hi

    try putting this in the GotFocus event of your txtBox.....

    Me.txtBoxName.SelStart = 0
    Me.txtBoxName.SelLength = Len(Me.txtBoxName.Text)

    This should auto select your text

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •