private void txtName_KeyDown(object sender, KeyEventArgs e)
if (e.KeyCode == Keys.Enter)
One way to do this is to build a function to perform whatever operation you need.
Then call that function from btnSave_Click and from TxtName_KeyDown.
That way you can have the shared code without one event needing to call the other.
Hope this helps.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?