Results 1 to 4 of 4

Thread: determine the order of clicked character.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    66

    determine the order of clicked character.

    I click to textbox which have a string.

    How can i determine what character i clickd to it ?

    Example : That string is " I am Ann"

    I click coordinate contains "m" character. How can i know i click that character.

    Thanks for helps.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: determine the order of clicked character.

    try this:

    vb Code:
    1. Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
    2.     MsgBox(TextBox1.GetCharFromPosition(New Point(e.X, e.Y)))
    3. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    66

    Re: determine the order of clicked character.

    Quote Originally Posted by .paul. View Post
    try this:

    vb Code:
    1. Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
    2.     MsgBox(TextBox1.GetCharFromPosition(New Point(e.X, e.Y)))
    3. End Sub
    Thanks it work. But that is char , i want to get index of it

    How can i do that ?

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: determine the order of clicked character.

    GetCharIndexFromPosition

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