i want to replace the current word under mouse cursor while user click on contextmenustrip dorpdownitem. i can get the word but unable to replace the word with new one here is my code, Any help greatly appreciated.
Private Sub tsmmutradifat__DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles tsmmutradifat_.DropDownItemClicked
Dim myclickeditem As String = correct_word(e.ClickedItem.Text)
Dim wordtoreplace As String
If Not myclickeditem = Nothing Then
If RichTextBox1.SelectedText = "" Then
' Code required
Else
wordtoreplace = RichTextBox1.SelectedText
If wordtoreplace.EndsWith(" ") Then
myclickeditem = myclickeditem & " "
End If
If wordtoreplace.StartsWith(" ") Then
myclickeditem = " " & myclickeditem
End If
RichTextBox1.SelectedText = myclickeditem
End If
End If
End Sub
ok will see, future time, when will it be
ok made it. find the below code on a forum and changed it according to my needs it a little odd but working.
In mouse move event
and then simply replace then word