Gidi,
If I understand your questions right - With #1 You would not need to create
a custom textbox to override ProcessCmdKeys - That can be done in your form
OR it can be done in a custom textbox it depends on your application. If you
know that your form is not going to handle any weird keys like this then
create a custom control to handle it - Just make sure you check that the
textbox on your UserControl has focus - Just as a fail safe incase you do
use ProcessCmd on your form.
<code>
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg,
System.Windows.Forms.Keys keyData)
{
if (this.textBox1.Focused)
{
if (keyData == Keys.Enter)
{
//Your method to handle the enter
return true;
//This needs to return true or your application
//Won't "see" the enter being handled in the
ProcessCmdKeys
}
else if (keydata == (Keys.Enter + Keys.Shift))
{
//Your method to handle Shift + Enter
return true;
}
}
return base.ProcessCmdKey(msg, keyData);
}
</code>
As for setting the new line in the textbox - I'm not sure EXACTLY off hand
how to go about that - but I'm sure you can set the selected text in a text
box - so get the last index of the text box and set it as selected
HTH
Brendon