Results 1 to 9 of 9

Thread: current cursor location

  1. #1

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552

    current cursor location

    how do i know what is the current location of the cursor inside a richtextbox? something like [if i type] brown monkey is not me and the cursor is in m, i have 7. thanks...
    Last edited by brown monkey; Jun 26th, 2004 at 01:24 AM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    One way , use MousePosition methods .
    VB Code:
    1. MousePosition.X
    2. MousePosition.Y

  3. #3

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    sorry for not clearing the things that i want. by the way pirate mate, thanks for the reply. i mean the blinking cursor inside richtextbox. something like if i have the brown monkey is not me text in the richtextbox and [say] if i have the cursor in the m of monkey, i can get the value 7. sort of 7th character. thanks

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I see . Let me try to do you a demo!

  5. #5

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    i think this is it
    VB Code:
    1. dim i as integer=richtextbox1.selectionstart
    2. .
    3. .
    4. .
    5. richtextbox1.selectionstart=i
    is this the way mate? i don't know much about this. lol...

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Yeah . You just put that code in the MouseDown or MouseUp events . It's up to you .

  7. #7

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    thanks so much pirate mate.

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    You solved your own problem .

  9. #9

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    i've got another prob [related]. how do i get the current string where the cursor is located. say, brown monkey is not me text and the cursor is in m of monkey. i want to get the string monkey...

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