vb Code:
Private ctrlM As Boolean = False Private Sub TextBox1_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.M AndAlso _ e.Control AndAlso _ Not e.Shift AndAlso _ Not e.Alt Then Me.TextBox1.AppendText("This is a comment.") Me.ctrlM = True End If End Sub Private Sub TextBox1_KeyPress(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = ControlChars.Cr AndAlso Me.ctrlM Then e.Handled = True Me.ctrlM = False End If End Sub




Reply With Quote