Results 1 to 2 of 2

Thread: richtextbox auto capitalized

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    richtextbox auto capitalized

    how can i make an auto capitalized text after typing a period and two spaces in richtextbox?

  2. #2
    Member
    Join Date
    Dec 2006
    Location
    Derby, UK
    Posts
    58

    Re: richtextbox auto capitalized

    Have a look at StringVariable.SubString (or the older InStr) and StrConv in the RichTextBox TextChanged event. Something like:
    vb Code:
    1. Const autoCaps As String = ".  "
    2.  
    3. Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles RichTextBox1.TextChanged
    4.   If Me.RichTextBox1.SelectionStart > 3 Then
    5.     If Me.RichTextBox1.Text.Substring(Me.RichTextBox1.SelectionStart - 3, 3) = autoCaps Then
    6.       Me.RichTextBox1.Text = StrConv(Me.RichTextBox1.Text, VbStrConv.Uppercase)
    7.     End If
    8.   End If
    9. End Sub

    Chris.

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