Link to home
Start Free TrialLog in
Avatar of RobertoFreemano
RobertoFreemanoFlag for United Kingdom of Great Britain and Northern Ireland

asked on

format text by Keys - vb.net 2003

Hi Experts,

I wish to write a word processing application which will format text if a specific key is pressed. The document will be RTF based.

Example: If 'CTRL' and letter 'C' is pressed, then left margin to 4.1" ...and if ENTER key is pressed = vbCrLf down to next line & to normal left Margin  2.7"

Is this easy? as I have played around with text boxes and not really got anywhere.

Cheers,
Roberto
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RobertoFreemano

ASKER

Thanks Bob,

I completed my code with:
------------------------------------------------------
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        Select Case keyData
            Case Keys.Control Keys.C
          RichTextBox1.SelectionAlignment = HorizontalAlignment.Center
            RichTextBox1.SelectionHangingIndent = 200
            RichTextBox1.SelectionIndent = 100
        End Select
    End Function
------------------------------------------------------