I had someone else bring this to me this morning. I found a VS2005 solution but it didn't work in VS2003 that they're using in their project. I don't have VS2003 installed on my system so I wanted to see if anyone out there had a solution.
Here's the situation.
The task is to add a comments hotkey to an existing VS2003 app. The users want to use Ctrl-M to insert a pre-defined partial comment into a multi-line textbox. The following code was placed in the KeyUp event of the textbox
vb Code:
If e.Control = True And e.KeyCode = Keys.M Then txtComment.Text = txtComment.Text & " " & CurrentUserProfile.DefaultComment e.Handled = True End If
The comment appears as it should but a carriage return is added to the beginning of it.
I can surpress this in VS2005 by moving the code to the KeyDown event and adding the following line
vb Code:
e.SuppressKeyPress = True
But this property isn't available in VS2003 from what I understand.
So, is there an easy way to supress this CR in VS2003?
We can probably talk them into using Alt-M for their macro if we have to. It's just that they have another, 3rd party, program that uses Ctrl-M for this and they would like it to be consistant if we can do it that way. Also, they want the field blank when the form is loaded which eliminates loading the default comment on Form_Load as an option.


Reply With Quote
