Hi guys,
how to make a button the default action for a textBox specially when Enter button hited???
Thanks
[EL-Prince]
Hi guys,
how to make a button the default action for a textBox specially when Enter button hited???
Thanks
[EL-Prince]
I think this is what you are looking for. I didn't test it with an application though.
tbMessage is a rich text box and btnSend in this (pretend) example would send the text to the other conversant. SendMessage was added in just so the button would have an action.
private void tbMessage_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter && tbMessage.Focused)
btnSend.PerformClick();
}
private void btnSend_Click(object sender, EventArgs e)
{
SendMessage(tbMessage.Text);
}
Hi,
dude thanks for your pretty share, but I found what I was looking for which is the AcceptButton property in the form object.
Thanks
[EL-Prince]
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.