Change the following line:
frmDetail.Show()
To
frmDetail.ShowDialog()
When using frmDetail.Show(), the code after it will continue being executed after the form shows, while frmDetail.ShowDialog() shows a modal form, meaning the code after it will get executed only after the forms closes.