'Form1にボタン(Button1)とテキストボックス(TextBox1)を配置 Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("ボタンが押されたね!") End SubButton Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.Enter Then Button1.PerformClick() End If End Sub End Class