If you are talking about a C# Windows application then here's an idea, may give you a place to start.
// In your InitializeComponent() method, make sure you've set the event
// Set the event to catch a keypress from your Password textbox
this.txtPassword.KeyPress +=
new System.Windows.Forms.KeyPressEventHandler(this.txtPassword_KeyPress);
.....
// The Event Handler
private void Generic_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
// When the "Enter" key is pressed, fire your button click event
// using appropriate arguments, EventArgs.Empty, or null
if(e.KeyChar == (char)13)
cmdLogin_ButtonClick(this, EventArgs.Empty);
}