Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Underline Only the Last Word in Richtextbox


Underline Only the Last Word in Richtextbox

Author
Message
ryoka012
ryoka012
Forum Member
Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)

Group: Forum Members
Posts: 1, Visits: 1
Hi experts,



I have this code but this is on click event button to underline the last word.

but this is in click event using button.



How can i convert this on keydown event with



If e.KeyCode = Keys.Space Then



End If





Dim count As String = RichTextBox1.Text

Dim LastWord As String = count.Split(" ").Last()

Dim index As Integer = RichTextBox1.Find(LastWord, 0, RichTextBoxFinds.WholeWord)

If index <> -1 Then



RichTextBox1.SelectionStart = index

RichTextBox1.SelectionLength = LastWord.Length

RichTextBox1.SelectionFont = New Font("Courier New", 15, FontStyle.Underline)

End If





Thanks.
zack
zack
Forum God
Forum God (1.3K reputation)Forum God (1.3K reputation)Forum God (1.3K reputation)Forum God (1.3K reputation)Forum God (1.3K reputation)Forum God (1.3K reputation)Forum God (1.3K reputation)Forum God (1.3K reputation)Forum God (1.3K reputation)

Group: Forum Members
Posts: 102, Visits: 110
Add the code to the RichTextBox1_KeyDown event.
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search