Results 1 to 7 of 7

Thread: Help with pasting

  1. #1

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674

    Help with pasting

    When I paste into a RTBox how can I make it paste starting at the point where I place the cursor?

    JO

    VB Code:
    1. 'I'm currently using this to paste
    2.  
    3. RTB1.Text = Clipboard.GetText
    4.  
    5. 'but this will overwrite anything already in the RTB1
    "I have not failed. I've just found 10,000 ways that won't work."
    'Thomas Edison'

    "If we knew what it was we were doing it wouldn't be called research, would it?"
    'Albert Einstein'

    VB6

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    RTB1.Text = Left(RTB1.Text, CursPos) & ClipBoard.GetText & Mid(RTB1.Text, CursPos + 1)
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674
    That places it at the beggining of the file but not where the cursor is.
    "I have not failed. I've just found 10,000 ways that won't work."
    'Thomas Edison'

    "If we knew what it was we were doing it wouldn't be called research, would it?"
    'Albert Einstein'

    VB6

  4. #4
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    That's becuase you are not using option explicit and did not declare curspos.

    CursPos should be however you are determining the cursor location, like SelLength.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  5. #5

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674
    Oh! Thanks.

    ignorance is bliss
    "I have not failed. I've just found 10,000 ways that won't work."
    'Thomas Edison'

    "If we knew what it was we were doing it wouldn't be called research, would it?"
    'Albert Einstein'

    VB6

  6. #6
    Megatron
    Guest
    It's easier just to use the "SelText" property.
    Code:
    RTB1.SetFocus
    RTB1.SelText = Clipboard.GetText

  7. #7
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Well, chalk another one up to MegaTron .

    I feel like I am pretty proficient when it comes to VB, but MegaTron, your skills seems to dwarf mine own. (As in make my skills look miniscule compared to yours.)

    Well, at least I'm learnin somethin.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

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